wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Question about compiling a java file with javac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question about compiling a java file with javac" Watch "Question about compiling a java file with javac" New topic
Author

Question about compiling a java file with javac

Gurlok Kaiser
Greenhorn

Joined: Nov 28, 2012
Posts: 3
Hy Guys, I'm new here, both as user and with java (well to be honest i don't know anything about java) I would like to ask a question: i found the source code of a class i'm interested to edit a bit (the ExternalDeoder.class of the Jpcsp emulator written in java which some of you may know about it). I added a line to the ExternalDecoder.java file, but when i try to compile it with javac i encounter a bunch of errors (they are about 100), as from what i can read in the promt there are 2 kinds of errors: "cannot find symbols" and "method does not override or implement a method from a supertype". What i would like to ask is: Since i'm a complete ignorant regarding programming and java, Can I compile the .class file from the ExternalDecoder.java file only, or do I need ALL the src files related to it?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18520
    
  40

Gurlok Kaiser wrote:Hy Guys, I'm new here, both as user and with java (well to be honest i don't know anything about java) I would like to ask a question: i found the source code of a class i'm interested to edit a bit (the ExternalDeoder.class of the Jpcsp emulator written in java which some of you may know about it). I added a line to the ExternalDecoder.java file, but when i try to compile it with javac i encounter a bunch of errors (they are about 100), as from what i can read in the promt there are 2 kinds of errors: "cannot find symbols" and "method does not override or implement a method from a supertype". What i would like to ask is: Since i'm a complete ignorant regarding programming and java, Can I compile the .class file from the ExternalDecoder.java file only, or do I need ALL the src files related to it?


No. You don't need all the source files to compile. However, you do need the dependent classes and jar files -- which is the same need when you run the program.


And BTW, welcome to the ranch...
Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Gurlok Kaiser
Greenhorn

Joined: Nov 28, 2012
Posts: 3
I see, Thanks for the reply (and for welcoming me aswell). So, to compile that file, how should i order all the classes files and jar ones? I mean if i should put them together in a random folder, or if i should follow the folders order and structure?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18520
    
  40

Gurlok Kaiser wrote:I see, Thanks for the reply (and for welcoming me aswell). So, to compile that file, how should i order all the classes files and jar ones? I mean if i should put them together in a random folder, or if i should follow the folders order and structure?


Jar files must be specified in the classpath. Class files must be ordered in directory paths related to what package they are in. And the root of the directory path must be specified in the classpath.

See the tutorial on classpaths for complete details.

http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

Henry
Gurlok Kaiser
Greenhorn

Joined: Nov 28, 2012
Posts: 3
Well just two minutes ago after so many attempts i finally compiled what i tried to do (well i had to compile the whole package instead of doing only the wanted file, but since i'm a newbie i can't complain at all). Thanks for the help Henry Wong
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Question about compiling a java file with javac
 
Similar Threads
eclipse jdt compiler IProblem (getting the line number of compilation error)
Some Runtime vs. Compile Time SCJP 6.0 Mock Exam Questions
this and static don't mix
generating class file without using javac command
packing classpath errors