plr
plr

Reputation: 21

How to convert a .java file to a .class file?

I am new to Java. I was given some .java files and was told if I could convert them, then I could use them. It is for a game bot I am using. They changed to a new API which I don't understand, so the bot won't run unless it is implemented in .class files.

Can someone explain me how to convert these .java files to fully functional .class files?

Upvotes: 2

Views: 32820

Answers (3)

KARTHIKEYAN.A
KARTHIKEYAN.A

Reputation: 20138

if you want to compile multiple java files into class files then you follow given procedure.

Syntex:

javac <options> <source files>

Example:

javac -cp -d classfolder *.java 

here

options are -cp (copy), -d (directory), classfolder (directory name)

source files are * (all) .java files

Upvotes: 0

polygenelubricants
polygenelubricants

Reputation: 383966

You need to compile the .java source code to the .class byte code. Use a Java compiler like javac from Sun's JDK, or if you're using an IDE like Eclipse, it already has a compiler that can generate the .class files for you (usually in the \bin directory).

See also

Related links for javac

Upvotes: 5

speshak
speshak

Reputation: 2477

You need to compile the java using javac (the java compiler) You can get it as part of the JDK which you can get from Oracle (http://www.oracle.com/technetwork/java/javase/downloads/index.html)

You'll need to run a command like the following

javac foo.java

Which will produce a corresponding foo.class

Upvotes: 0

Related Questions