Solved

Running/Compiling *.java (Java 5.0) file in Oracle Sql Devleloper

Posted on 2007-03-27
12
1,242 Views
Last Modified: 2013-12-12
I have installed Oracle Sql Developer 1.1.2.25.70 with Java Platform 1.5.0_10 on Fedora 5.

Is it possible to compile and run a *.java file without connecting the Oracle Sql Developer to a database?

If it is possible how do i do this?
0
Comment
Question by:gram77
  • 7
  • 5
12 Comments
 
LVL 20

Expert Comment

by:gatorvip
ID: 18800067
I don't really understand your question. You want to compile a .java file in SQL Dev? That's not what the app is for...  Also, SQL Dev doesn't come with the JDK, just the JRE.
0
 

Author Comment

by:gram77
ID: 18800093
So you mean you can't develop java applications in Oracle Sql Developer.

Oracle Sql Developer needs JDK preinstalled. before installing Sql Developer.
0
 

Author Comment

by:gram77
ID: 18800101
However, Sql Developer is able to understand all Java Keywords correctly as it prints them i blue..
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 20

Accepted Solution

by:
gatorvip earned 500 total points
ID: 18800239
If you have the JDK preinstalled, you don't *need* SQL Developer to compile .java files. You can use notepad for that, in the worst case. SQL Developer is to be used for database development, running queries, etc.

http://www.oracle.com/technology/products/database/sql_developer/index.html

***
 Oracle SQL Developer is a free graphical tool for database development. With SQL Developer, you can browse database objects, run SQL statements and SQL scripts, and edit and debug PL/SQL statements. You can also run any number of provided reports, as well as create and save your own. SQL Developer enhances productivity and simplifies your database development tasks.
****

However, if you *really* want to use SQL Dev for java compilation, you can customize behavior under Tools/Preferences.
- Tools/External Tools/New then enter the path to the javac.exe compiler you want to use
0
 
LVL 20

Expert Comment

by:gatorvip
ID: 18800250
You can definitely customize SQL Dev to recognize keywords, Tools/Preferences/Code Editor/Syntax Colors
0
 

Author Comment

by:gram77
ID: 18800574
gatorvip:

I addes javac as an external tool.

It shows in the Tools menu as well as the context menu on right clicking.

It compiles the java program well.

However, when i run the .java program, it raises the error:

"The target cannot be started because there is no active project"
0
 

Author Comment

by:gram77
ID: 18800748
well i have added java i.e.
/usr/java/jre1.5.0_10/bin/java as an external tool too.

However, when i run Writer2.java class file, i get the following error.
/usr/java/jre1.5.0_10/bin/java /mnt/win/linux_bkup/scripts/java/Writer2
Exception in thread "main" java.lang.NoClassDefFoundError: /mnt/win/linux_bkup/scripts/java/Writer2

/usr/java/jre1.5.0_10/bin/java Writer2
Exception in thread "main" java.lang.NoClassDefFoundError: /mnt/win/linux_bkup/scripts/java/Writer2
0
 

Author Comment

by:gram77
ID: 18800778
However, in Fedora Terminal Window, i get the desired result:
[root@localhost java]# /usr/java/jre1.5.0_10/bin/java Writer2
12
howdy
folks
0
 
LVL 20

Assisted Solution

by:gatorvip
gatorvip earned 500 total points
ID: 18801601
you will have to modify your classpath for your executables to work
0
 

Author Comment

by:gram77
ID: 18801803
gatorvip:
Modify the classpath in Fedora or Sql Developer.
You mean i should change the classpath in Sql Developer to the resemble classpath in Fedora?
0
 
LVL 20

Expert Comment

by:gatorvip
ID: 18802966
well, you can use it as a parameter directly in SQL Dev:

java -cp <your_classpath> (don't forget to include the current directory ".")
0
 

Author Comment

by:gram77
ID: 18813422
gatovip:
Wow! i am able to work on java using Oracle Sql Developer.

I am able to compile and run java source files :)

Many Thanks.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question