Re: Environment variable wrongly set
On 02/10/10 05:13, bruce wrote:
On Oct 1, 7:25 pm, markspace <nos...@nowhere.com> wrote:
On 10/1/2010 3:47 PM, bruce wrote:
I went to set the System Classpath for my JDBC Connect and
accidentally set the INCLUDE variable. Can I back that setting out by
doing a System Restore to a system copy before I made the mistake?
Yeah, what Lew said. Just change INCLUDE back. If you don't know,
leave it blank. Then if you find an error, fix it.
This stuff probably should be set in a script where the effect is local,
rather than system wide, so you can set different variables for
different runtime environments.
Okay.. Need some help here. I was setting up to run JDBC mysql
connect under NetBeans and also to run Java jar's from the command
line. How do I do this, other then to set the system environment
variable, CLASSPATH. What would a "script" look like? My knowledge of
scripts goes back to .bat files? That knowledge is so old, I've
forgotten how to write one!! How about DOS 3<grin>!!!
NetBeans should handle it all for you, if you've created an NetBeans
The application jar should be in the dist subdirectory of the project.
Any other jar libraries which the app. jar requires should have been
copied to the dist/lib subdirectory. The manifest of the application jar
should set the classpath to include all necessary jar's from the
Then you ought to able to run the jar by the command (as output by
NetBeans during the build)
java -jar <path-to-project>/dist/<application>.jar
If that's not working then you need to look into why NetBeans isn't
creating the correct dist/lib/manifest setup, rather than messing with
the classpath. Besides, if your executable is a jar, and you run it with
java -jar then no amount of messing with CLASSPATH, or the -cp
command-line argument, is going to help.
If your application requires the JDBC MySQL connector then you should
add it to the project properties in NetBeans. In the project properties
section "Libraries" add that jar to the project (you generally need to
do this anyway so NetBeans can find the class files to compile it). Once
you've done this the jar should be copied to the dist/lib directory when
you build the application, and also added to the jar classpath in the
If the jar library is one which you are likely to use frequently you can
add it to NetBeans list of jar libraries. This makes it easier to add to
subsequent projects, and easier to manage if you have to move the jar at
some later time. You do this via the Tools/Libraries dialog.