Skip to main content

Linking classes to the main program in the command line window

2 replies [Last post]
klandathu
Offline
Joined: 2008-10-04

I have two programs; one with the main and another with a class that it uses. Both are extremely basic; nothing fancy going on. How do I use JDK6 Update 7 to execute both of them together (one of them as as class of the other)?

They're both in the same folder and if I comment out mention of my class in the main program it executes fine; but it recognizes the class I want it to use as a syntax error. Any tips?

Running basic windows, first time to write a program using JDK.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
klandathu
Offline
Joined: 2008-10-04

Thought I'd add some details.

The main program is "public class BookShelf" and the class I want to add is "public class ShelfAB".

I used "ShelfAB collumnAB = new ShelfAB();" at the top of my program to get it to accept my class, but it doesn't seem to be working. Both programs run fine by themselves.

jhipp117
Offline
Joined: 2008-08-24

Try the lesson on using packages and other lessons in the
same thread in the
Java Tutorials.