This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Joe Ess
  • salvin francis
  • fred rosenberger

Unable to Compile Classes

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. *.* package does not exist error..

My file imports the below:

import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.hssf.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

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 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

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 *.*

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\*.*

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:

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

Posts: 14740
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • 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 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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the 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.

Squanch that. And squanch this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!