• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to Compile Classes  RSS feed

 
Kari Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a bit confused, and could use some guidance. I have a new piece of code to execute, but am unable to. I believe there are two things wrong, I don't know how to fix.
1. import org.apache.poi I do not have this location.. org.apache on my local drive, but do have an apache poi jar file.
2. import.com.mycompany.ctc.internal.actions *.* package does not exist error..

My Populate.java file imports the below:

import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.hssf.util.*;

import com.mycompany.ctc.internal.actions.*;
import com.mycompany.ctc.internal.database.*;
import com.mycompany.as400.access.AS400JDBCPreparedStatement;
------------------------------------------------------------------------------------------

Command line (windows xp) I run the below:

C:\Codefolder>javac -cp .;ctc_util.jar;web-inf\lib\jt400.jar;web-inf\lib\poi-3.7-20101029.jar Populate.java

Error comes back,
java:6: package com.mycompany.internal.actions* does not exist
java:7: package com.mycompany.internal.database* does not exist

Then continues to provide errors on what within those two packages cannot be found in the Populate.java code file. For example the ConnectonManager (which resides in .database* )

So I set my -cp to include the path example:


C:\Codefolder>javac -cp .;ctc_util.jar;web-inf\lib\jt400.jar;web-inf\lib\poi-3.7-20101029.jar;web-inf\classes\com\mycompany\ctc\internal\database Populate.java

I still get the errors. So I went a step futher added *.* to the end.:
C:\Codefolder>javac -cp .;ctc_tuil.jar;web-inf\lib\jt400.jar;web-inf\lib\poi-3.7-20101029.jar;web-inf\classes\com\mycompany\ctc\internal\database *.* Populate.java

Didn't work. So I tried adding a backslash at the end:
C:\Codefolder>javac -cp .;ctc_tuil.jar;web-inf\lib\jt400.jar;web-inf\lib\poi-3.7-20101029.jar;web-inf\classes\com\mycompany\ctc\internal\database\*.* Populate.java

Still didnt work.

I researched on your site and found one suggestion was to build the .java files with the below command:
javac -d *.java

When I execute this in the ..\..\database folder I get the below error.
javac: not a directory: ConnectonManager.java

I am a bit stumped, and appreciate any help or suggestions anyone has on this. Thank you very much.

 
Junilu Lacar
Sheriff
Posts: 11477
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect some typos in some of the things you posted so ignoring those, you probably should just include web-inf\classes\ in your classpath. The compiler should then be able to find com.mycompany.ctc.internal.database with that. Also, does Populate.java reside in the directory from which you are compiling or is it some other directory? Did you declare Populate to be in a package or are you using the default package?

It seems strange to me that you're trying to compile a single class from the command line for what looks like actual work. Why aren't you using an IDE or a build system like Ant or Maven to do the heavy lifting for you?
 
Kari Smith
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the Populate.java file is a file to read in an excel file, connect to a server/database and populate the tables with the data..(just so you know what the code is doing.)

I took your suggestion on adding the web-inf\classes\ and it appears to see the ...\database and it worked..

Thank you very much. I have been beating my head against the wall for the past few hours, and it was the back slash after the classes\ that did it. Such a simple thing.

Again. Thanks.
Kari

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!