Help with running class file
I have downloaded some files for an app that are .class files and one folder that is a META-INF file.
The files are on the C drive so in the command prompt i have typed cd C:\ then pressed enter.
Then I have typed java -cp.BlablaServ
I get this error message
Unrecognised option : -cp.BlablaServ
Could not create the Java virtual machine
Can anyone help me with this as I cant see what I am doing wrong
Re: Help with running class file
The correct syntax should be:
java -cp class_path start_class_package.start_class
where:
class_path is the path to the base folder of all the class files.
start_class_package is the package path to the start class (note that in Java the folder structure must match the package declaration)
start_class is the class to start the program in (the one with the main method)
Re: Help with running class file
Ok thanks for the reply. Im totally new to Java just looked at it today so still getting to grips with some of the basic terms. I am a bit unsure about the package path.
I have a .zip file called Rserver located on the root of the C drive and inside it there is 11 class files, 2 folders, META-INF which contains Manifest.mf and Images folder. The main class file is called BlablaServer.class
How would I go about opening that file would it be something like this
java -cp C:\ Rserver.BlablaServer
I know this doesnt work though as I have tried it but looking for any further help on this
Re: Help with running class file
I created a jar file in the end and had to make sure the JDK was in the correct path. I went to Start>Control Panel>System>Advanced>Environment Variables and selected Path and entered where the JDK was which was C:\java\jdk1.5.0_06\bin\ for me.
Otherwise to run the class file through the command prompt each time just enter
java -cp . BlablaServ
Make sure you enter the spaces