Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 878
  • Last Modified:

how to control which version of jdk Netbeans uses

hi,

i am using the latest netbeans ide to build a simple jms java file,

but i am getting this:

init:
deps-jar:
Compiling 10 source files to

C:\wrox\pro_jms\Chapter04\Test\build\classes
C:\wrox\pro_jms\Chapter04\AccountsDepartment.java:4: package

javax.jms does not exist
import javax.jms.*;
C:\wrox\pro_jms\Chapter04\AccountsDepartment.java:11: cannot find

symbol
the netbeans ide i am using uses jdk_1.6, which when i use directly

to compile in command line mode, works.  can anyone tell me why this

is happening?

also, if possible, can someone tell me how to get Netbeans to switch

from jdk_1.6 to jdk1.4?  i tried modifying the JAVA_HOME env

variable, but didn't work.
0
mmingfeilam
Asked:
mmingfeilam
  • 2
2 Solutions
 
UrosVidojevicCommented:
Hi,

To change jdk version that NetBeans use change contents of file:

C:\Program Files\netbeans-5.5.1\etc\netbeans.conf
(exact netbeans directory name depends on which version of netbeans you're using)

On my computer, contents of this file is:





# ${HOME} will be replaced by JVM user.home system property
netbeans_default_userdir="${HOME}/.netbeans/5.5.1"

# options used by netbeans launcher by default, can be overridden by explicit
# command line switches
netbeans_default_options="-J-Xms32m -J-Xmx128m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true"
# --- tips for more advanced options you could use ---
# for JDKs where it is supported (for example Sun's JDK 5.0 and newer),
# you can use the following set of options which enable Concurrent Mark and
# Sweep garbage collection algorithm and improve UI responsiveness
# (see FAQ item http://wiki.netbeans.info/wiki/view/FaqGCPauses)
#netbeans_default_options="-J-Xms32m -J-Xmx128m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -J-Xverify:none -J-Dapple.laf.useScreenMenuBar=true -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled"
#
# if you're processing large wsdl files(e.g. when creating or consuming web services) you should set -J-Xmx256m instead of -J-Xmx128m
# ---

# default location of J2SE JDK, can be overridden by using --jdkhome <dir> switch
netbeans_jdkhome="C:\Program Files\Java\jdk1.6.0_02"

# clusters' paths separated by path.separator (semicolon on Windows, colon on Unices)
#netbeans_extraclusters="/absolute/path/to/cluster1:/absolute/path/to/cluster2"






You need to change just the string "C:\Program Files\Java\jdk1.6.0_02" (in your case it will be something else) to the directory of jdk which you want to use.

0
 
mmingfeilamAuthor Commented:
thanks. but now during netbeans startup, it's complaining about not being to install:
JUnit Tests, Web Services Core, etc.  because java 1.5 was requested but only 1.4 is running.
0
 
TheMajesticCommented:
hi,

i think this will help u a lot

wiki.netbeans.info/wiki/view/NetBeansUserFAQ
installer.netbeans.org/docs/NetBeansJDKBundleInstaller.html
www.netbeans.org/community/releases/60
nbi.netbeans.org/docs/nbi_install_m11.html

0
 
mmingfeilamAuthor Commented:
thanks for all your help, i just found out the netbeans 5.5 only accept jdk 1.5 or above, so i had to use netbeans 5.0.  but i still can't figure out why even when i was using netbeans 5.5, i can compile jms code:

javax.jms does not exist
import javax.jms.*;
...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now