I made a program using Eclipse, but I want to learn to compile it with JavaC.
I downloaded the JavaSDK jdk1.7.0 and installed it at C:\
My .java file is in C:\java
I then compiled the program using C:\jdk1.7.0\bin\javac Game.java
It uses a package layout manager so I downloaded swing-layout-1.0.1.jar and just put it straight into C:\ then tried to execute using:
java -classpath C:\swing-layout-1.0.1.jar Game
All I get is Error:Could not find or load main class Game
Any idea what I’m doing wrong?
You forgot to add your code to classpath. You should provide either jar file or directory where your classes are located, i.e.
java -classpath C:\swing-layout-1.0.1.jar;myapp.jar Gameor
java -classpath C:\swing-layout-1.0.1.jar;c:\proj\myapp\classes Game