Results 21 to 37 of 37
Thread: Help with Linux Makefile
- 06-10-2010, 02:53 PM #21
- 06-10-2010, 03:32 PM #22
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,394
- Blog Entries
- 7
- Rep Power
- 17
- 06-10-2010, 10:55 PM #23
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
That is the error code I receive when I try to execute my makefileJava Code:rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ make javac -g -sourcepath /Desktop/attachments_2010_06_07/ClassSched/src/classschedMain.java Main.java:168: cannot find symbol symbol : class Course location: class classsched.Main public static Course readCourses(String[] n) { ^ Main.java:194: cannot find symbol symbol : class Rooms location: class classsched.Main public static Rooms readRooms(String[] n) { ^ Main.java:19: cannot find symbol symbol : class Rooms location: class classsched.RoomCapacityComparator int room1Cap = ((Rooms) room1).getCap(); ^ Main.java:21: cannot find symbol symbol : class Rooms location: class classsched.RoomCapacityComparator int room2Cap = ((Rooms) room2).getCap(); ^ Main.java:39: cannot find symbol symbol : class Course location: class classsched.CourseCapacityComparator int course1Cap = ((Course) course1).getCap(); ^ Main.java:41: cannot find symbol symbol : class Course location: class classsched.CourseCapacityComparator int course2Cap = ((Course) course2).getCap(); ^ Main.java:61: cannot find symbol symbol : class Rooms location: class classsched.Main List<Rooms> roomsList = new ArrayList<Rooms>(); // List implemented as growable array ^ Main.java:61: cannot find symbol symbol : class Rooms location: class classsched.Main List<Rooms> roomsList = new ArrayList<Rooms>(); // List implemented as growable array ^ Main.java:62: cannot find symbol symbol : class Course location: class classsched.Main List<Course> classList = new ArrayList<Course>(); ^ Main.java:62: cannot find symbol symbol : class Course location: class classsched.Main List<Course> classList = new ArrayList<Course>(); ^ Main.java:63: cannot find symbol symbol : class Course location: class classsched.Main List<Course> classListcopy = new ArrayList<Course>(); ^ Main.java:63: cannot find symbol symbol : class Course location: class classsched.Main List<Course> classListcopy = new ArrayList<Course>(); ^ Main.java:65: cannot find symbol symbol : class CSVReader location: class classsched.Main CSVReader classReader = new CSVReader(new FileReader("spring2010.csv")); //Uses the CSVReader package to read the "spring.csv" file. ^ Main.java:65: cannot find symbol symbol : class CSVReader location: class classsched.Main CSVReader classReader = new CSVReader(new FileReader("spring2010.csv")); //Uses the CSVReader package to read the "spring.csv" file. ^ Main.java:90: cannot find symbol symbol : class CSVReader location: class classsched.Main CSVReader roomsReader = new CSVReader(new FileReader("classrooms.csv")); //Uses the CSVReader to read in the "classrooms.csv" file. ^ Main.java:90: cannot find symbol symbol : class CSVReader location: class classsched.Main CSVReader roomsReader = new CSVReader(new FileReader("classrooms.csv")); //Uses the CSVReader to read in the "classrooms.csv" file. ^ Main.java:101: cannot find symbol symbol : class Course location: class classsched.Main Course aClass = classList.get(x); ^ Main.java:103: cannot find symbol symbol : class Rooms location: class classsched.Main Rooms aRoom = roomsList.get(y);//Using the object class function through the list ^ Main.java:114: cannot find symbol symbol : class CSVReader location: class classsched.Main CSVReader classReadercopy = new CSVReader(new FileReader("spring2010.csv")); //Uses the CSVReader package to read the "spring.csv" file. ^ Main.java:114: cannot find symbol symbol : class CSVReader location: class classsched.Main CSVReader classReadercopy = new CSVReader(new FileReader("spring2010.csv")); //Uses the CSVReader package to read the "spring.csv" file. ^ Main.java:169: cannot find symbol symbol : class Course location: class classsched.Main Course aCourse = new Course(); ^ Main.java:169: cannot find symbol symbol : class Course location: class classsched.Main Course aCourse = new Course(); ^ Main.java:195: cannot find symbol symbol : class Rooms location: class classsched.Main Rooms aRoom = new Rooms(); ^ Main.java:195: cannot find symbol symbol : class Rooms location: class classsched.Main Rooms aRoom = new Rooms(); ^ 24 errors make: *** [Main.class] Error 1 rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$
When I try and run my java after doing Javac Main.java Course.java Rooms.java CSVReader.java CSVParser.java
I executed three different tried.. java Main, java main, and java classsched.Main
These are my error codesJava Code:rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java Main Exception in thread "main" java.lang.NoClassDefFoundError: Main (wrong name: classsched/Main) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: Main. Program will exit. rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java main Exception in thread "main" java.lang.NoClassDefFoundError: main Caused by: java.lang.ClassNotFoundException: main at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: main. Program will exit. rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java classsched.Main Exception in thread "main" java.lang.NoClassDefFoundError: classsched/Main Caused by: java.lang.ClassNotFoundException: classsched.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: classsched.Main. Program will exit. rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$
- 06-10-2010, 11:02 PM #24
It appears that your Main class is in the package: classsched
Are the other classes also in packages?
Does the classpath point to the folder containing the classsched folder?
Are all the classes in that package in the classsched folder?
To execute the program go to the folder containing the classsched folder that contains all the class files and enter:
java classsched.Main
- 06-10-2010, 11:04 PM #25
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
I just spoke to my professor, and I explained to him that makefile for Java is outdated, and what is currently being used is Ant.. he states that as long as it can run and execute in a linux environment I will be fine.. are there any applications that can automate the process?
Or maybe a better start is.. how to execute my files correctly.. I have already compiled it with no errors.. and have the files I need in a .class file.. executing it with the commands java main, java Main, or java classsched.Main (classsched is the package name) gives me errors
- 06-10-2010, 11:06 PM #26
Using a package, you need to backup the folders used in package path to be in a folder where java can find the class files.
- 06-10-2010, 11:06 PM #27
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Yes, the other classes are in packages, package classschedJava Code:Exception in thread "main" java.lang.NoClassDefFoundError: classsched/Main Caused by: java.lang.ClassNotFoundException: classsched.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: classsched.Main. Program will exit. rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$
Yes, the classpath is JFLAGS = -g -sourcepath /Desktop/attachments_2010_06_07/ClassSched/src/classsched
Yes, lal the classes in the package are in the classsched folder
- 06-10-2010, 11:10 PM #28
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
I am a bit confused by how to do this..
If I am in a terminal where the path is suppose to be suppose
.../src/classsched/ is where all of my .class and .java is.. and i am also executing my java from here.. do I need to create a copy of classsched and place that copy inside the ..../src/classsched/ directory?
- 06-10-2010, 11:10 PM #29
You left off the command line. Need to see the location and the command that was issued.
Is Main in a package?
Is the Main.class file in: /Desktop/attachments_2010_06_07/ClassSched/src/classsched
If so go to: /Desktop/attachments_2010_06_07/ClassSched/src/
and issue: java classsched.Main
- 06-10-2010, 11:11 PM #30
Sorry. By backup I meant moving UP the folder chain to the parent folder. The one that contains the classsched folder.
- 06-10-2010, 11:13 PM #31
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java classsched.Main
- 06-10-2010, 11:15 PM #32
Your in the wrong folder. Unless there is a folder named classsched in the classsched folder you are currently in. Can you do a "cd .." to move up one level?
- 06-10-2010, 11:16 PM #33
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
Yes, Main is in the package classsched;
The name of main is Main.java
Java Code:rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$ ls classsched opencsv-2.2 rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$ cd classsched/ rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ ls classrooms.csv CSVParser.java~ Main.java~ Rooms.java~ test.csv Course.java CSVReader.java makefile spring2010.csv Course.java~ CSVReader.java~ makefile~ spring.csv CSVParser.java Main.java Rooms.java springtest.csv rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ java classsched.Main Exception in thread "main" java.lang.NoClassDefFoundError: classsched/Main Caused by: java.lang.ClassNotFoundException: classsched.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: classsched.Main. Program will exit. rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src/classsched$ cd ..rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$ ls classsched opencsv-2.2 rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$ java classsched.Main Exception in thread "main" java.lang.NoClassDefFoundError: classsched/Main Caused by: java.lang.ClassNotFoundException: classsched.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: classsched.Main. Program will exit. rob@rob-laptop:~/Desktop/attachments_2010_06_07/ClassSched/src$
- 06-10-2010, 11:18 PM #34
Where are the .class files? Your ls command only show .java files. And a few .csv
- 06-10-2010, 11:23 PM #35
Member
- Join Date
- May 2010
- Posts
- 19
- Rep Power
- 0
wow I'm embarassed. it must have gone away after I was experimenting with the makefile and I ran make clean. I went into the ../src/ folder and executed java classsched.Main and it ran. But there was an error in the code with finding the text files.. I'm going to try and work with this for a quick second
Edit 1**
okay, I have a question.. Using the CSVReader.java and CSVParser.java.. they were originally in another package,
rob@rob-laptop:~/Desktop/ex/ClassSched/src$ ls
classsched opencsv-2.2
They were taken from opencsv-2.2 and I pulled out the files.. how can I compile my project while keeping the files within that other package?
Edit 2**
Alright, I decided to strip the CSVReader.java and CSVParser.java completely from its original package..
I replaced their original package with package classsched
I removed the folder csv2.2
I am still able to build and run my program successfully within Netbeans.. which is outputting a file called "assignments.csv"
But fter compiling with no errors, then running the program on the Linux environment, my program catches the "File Not Found exception".. any reason why it would work on Netbeans and not while running it on Linux?
Edit 3**
I got it to fully run and compile! I had to bring the .csv files outside to where /src/ is so I can see classsched directory, and the csv files.. Now I need to learn how to compile it with makefile..Last edited by ruerric; 06-10-2010 at 11:59 PM.
- 07-23-2010, 03:42 AM #36
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
probably too late for you ruerric, but I think you just need to take the $ away from *.java in the 2nd line below:
.java.class:
$(JC) $(JFLAGS) *.java
- 07-23-2010, 03:46 AM #37
Member
- Join Date
- Jul 2010
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Linux Shell
By rp181 in forum Advanced JavaReplies: 2Last Post: 01-30-2010, 04:51 AM -
MakeFile
By divyanshu023 in forum New To JavaReplies: 1Last Post: 09-18-2009, 08:16 AM -
Running Linux
By selva.bics in forum AWT / SwingReplies: 1Last Post: 08-31-2009, 07:01 PM -
[SOLVED] Windows Linux conflict - TrayIcon image not display in Linux
By Eranga in forum Advanced JavaReplies: 6Last Post: 04-08-2009, 04:05 AM -
Help regarding makefile problem
By rams in forum NetworkingReplies: 0Last Post: 11-17-2008, 03:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks