0

I feel like I'm losing it slightly,

I've got my JDK setup with my PATH variables so javac works fine.

I'm trying to add environment variables under CLASSPATH so I don't have to repeatedly use -cp flag.

I'm constantly compiling my .java files in T:\WEB-INF\classes\myPack\Applications\myApp\

So at the moment I'm using the command javac -cp "..\..\..\;..\..\lib\*" *.java which compiles my files fine. But it's ugly and I hate typing it.

T:\WEB-INF\classes\myPack\ - Contains my custom classes I need to import

T:\WEB-INF\classes\myPack\lib\ (....\lib*) - Contains my third-party .jar files

However when I use absolute paths, it can't find the custom classes.

.;T:\WEB-INF\classes\myPack\lib\* - works fine - missing classes!
.;..\..\..\;T:\WEB-INF\classes\myPack\lib\* - works fine!
.;T:\WEB-INF\classes\myPack;T:\WEB-INF\classes\myPack\lib\* - Doesn't find the classes in the myPack folder.

I've looked it up and you don't need an asterisk if you want it to find class files so T:\WEB-INF\classes\myPack\ should be the correct path.

Am I missing something?

Thanks,

MikeS
  • 237
  • 1
  • 5
  • 22

1 Answers1

0

First I would use "/" instead of "\". You can use double-splash like so "\\". You can specify the folders where the .class live. Base on Oracle documentation, (class)path with wildcard /* can be specified to pickup zip and jar files within the directory.

Minh Kieu
  • 475
  • 3
  • 9
  • This isn't true, [Class path entries can contain the basename wildcard character *, which is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR.](http://docs.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html). I probably should have specified I'm using Java 7 – MikeS Jun 01 '16 at 07:15
  • Ok after double checked the JAVA doc @http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html. Wildcard zip or jar files can be specified. – Minh Kieu Jun 01 '16 at 14:39