thinking in java在线 4th中自己将写的typeinfo.pets文件导出成jar包放入jre\lib\ext目录下

如何用myeclipse导出Java项目(含外部jar包)_百度知道
如何用myeclipse导出Java项目(含外部jar包)
将一个java项目(非web项目)导出为jar包后,不可以运行了,想是该项目引入了外部jar包的缘故(如连接数据库的驱动包),所以有异常,运行不了了,,请问,如何做才可以使导出的jar包可以直接运行?感激不尽
我有更好的答案
右键点击MyEclipse 里 需要到处的项目选择Export(导出) 选择需要导出的项目类型比如 如果是Java EE 就选择 java EE文件下面的WAR file 导出的war 放入tomcat的webapps文件夹下面 或者其他服务容器里面 运行 就可以访问了如果要导出成jar包 就选择java JAR file 即可
采纳率:68%
右击项目,单击export=》java=》选第三个Runnable Jar file (可执行的jar文件),Next,选择launch configuration(程序入口配置),Exportdestination(导出目标)Library handing:
选择第一个 引用的jar包会整合到项目中去。 选择第二个 引用的jar包会单独放在项目根目录下。选择第三个 引用的jar包会单独放在一个文件夹下,这个文件夹和导出的jar放在同一目录下,finish。
本回答被网友采纳
导出java项目有第三方包,解压缩该项目后(如Test.jar),打开META-INF下的MANIFEST.MF文件,修改此文件,加入Class-Path,如下:Class-Path:lib\commons-collections.jar lib\asm.jar lib\bcmail-jdk14-132.jar注意:(a)
在根目录下建立lib文件夹,将jar包全部拷贝进去;(b)
冒号后边有两个空格,jar和jar之间也要有两个空格,否则会报无效导出jar文件错误,多包时要换行,否则会包line too long错误,并且换行后前面也要有两个空格,否则也会报无效导出jar文件错误
本回答被网友采纳
你的jar包要在哪里运行?运行需要java虚拟机的支持。你说的不明白,我就回答的不明白O(∩_∩)O
其他1条回答
为您推荐:
其他类似问题
您可能关注的内容
myeclipse的相关知识
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。如何将java打包为安装文件并将jre一起打包其中_百度知道
如何将java打包为安装文件并将jre一起打包其中
我有更好的答案
第一次安装时要求系统有1.5版本以上的JDK,如果你的机器上有JDK,点Locate找到你机器上已安装的JDK目录下/bin/java.exe就可以进行安装了。下面就打包过程详细说明一下:第1步,默认即可。第2步,如果已经有制作好的jar文件,则下面一个&JARinEXE&。第3步,上面是项目名称,可随便填写,下面一个写出你想要将打包后的exe文件输出的目录:第4步,由于我的演示程序是图形的,所以选第一个,如果你的程序是控制台的,则选择第二个,Executable name写你将要生成的exe文件的名字,IconFile可以选择生成文件的图标第5步,首先,单击绿色的&+&号,在弹出的窗口中点Archive,然后找到起初已经做好的jar文件,&OK&后返回,在下面的Class Path里就出现jar文件路径后,再在上面Main Class栏内点击找到main所在的类,这一步即算完成:第6步,你系统的JRE版本,上面填个1.3,下面填1.6:当然,这样配置的程序只能在安装有JRE的机器上执行,发布时总要考虑的问题就是用户是否有能力在自己机器上安装JRE,总不能发布一个程序还要用户自己安装个JRE吧,下面我就介绍如何将JDK环境变量动态打包到exe中,在这里单击advancedoptions,选择searchsequence。首先把JRE复制到exe文件输出的目录里,我用的是c:\xaocker\,在弹出的窗口中,删除列表中所有项,然后单击绿+,选择directory并选择JRE的根目录(注意是拷贝后的目录)即可,单击ok后,再从图中单击advancedoptions,并选择preferred VM,在弹出的窗口中选择clienthostspotVM,单击next按钮继续:第7、8步是一些基本配置,默认即可,第9步编译,第10步你就可以点这个看到效果了:exe4j未注册的版本会出现对话框:点击确定之后就可以看到你程序的运行结果了!java.exe依照一套逻辑来寻找可以用的JRE,首先查找自己所在的目录下有没有JRE,其次查找自己的父目录下有没有JRE;最后才是查询Windows的注册表。现在我们的程序可以在任意的计算机上执行了,可是缺点是致命的,比方说我的程序才160K,可是不论走到哪里都要背着70多M的JRE,未免有点小题大做吧,其实作为我们的私有的JRE,好多内容都是可以抛弃的。Jre目录下的license都可以不要,bin下的执行文件只需要保留java.exe或者javaw.exe,lib下只要保留rt,jsse,jce,charsets几个库就可以了。除了i386和zi两个子目录外,其余的子目录都可以不要。Zi下只需要保留自己地区的子目录和其下的一些文件就可以。Lib下除了库之外的属性文件等等都要保留。这样清理一番,JRE仍然有接近50MB。还可以继续清理几个库文件里面不需要的内容,这需要仔细的整理,会很费功夫。最好能写出一个自动工具帮助我们整理它们。从Sun公司上下到的JMF里面附带的用Java写的媒体播放器就自带了JRE,只有几个MB。清理过后需要运行几遍我们的应用程序,以确保我们的JRE不缺少东西。
采纳率:96%
来自团队:
为您推荐:
其他类似问题
换一换
回答问题,赢新手礼包
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。Including the JRE in a NetBeans Platform Installer on Ubuntu Linux - DZone Java
Over a million developers have joined DZone.
{{node.type}}
{{ node.urlSource.name }}
{{node.downloads}}
{{totalResults}} search results
<input type="button" value="View All Results" ng-click="allResults()" class="btn btn-action" ng-disabled="searchT.length
{{announcement.body}}
Let's be friends:
1024 && edition)" class="content-right-images" header-affix-element="div.content">
1 && !articles[0].partner.isSponsoringArticle"
dc-slot="ads.sb2.slot(articles[0], 0)"
tags="ads.sb2.tags(articles[0], 0)" size="ads.sb2.size(articles[0], 0)">
<div class="content" ng-class="{'content-full': (width
DZone's Guide to
Free Resource
<div class="dz-like"
{{ articles[0].views | formatCount}}
Join the DZone community and get the full member experience.
– name, email, phone and global addresses – try our Data Quality APIs now at
The NetBeans Platform provides a very nicely integrated installer infrastructure () which alllows for creating native installers for various platforms (Linux and Windows, in particular). This does, in a cross-platform way, what various other installers do (NSIS, IzPack, etc), but with the advantage of being NetBeans Platform aware and completely configurable.
It is not immediately clear how to bundle a JVM because using the default &Package As | Installers& option in NetBeans IDE 7.0 will build installers that are dependent on an already installed JVM on the system. In this guide, with help from Geertjan and Dmitry, we aim to configure the build process so that:
Native installers will be built for (at least) Windows and Linux.
These native installers will have a bundled JVM, and thus not require the system they are installed on to have a pre-installed JVM.
Ensure that the installed NetBeans Platform application uses a private JRE (in fact, the same one that was bundled before) which is therefore not visible to other applications in the system.
Getting a nice installer cycle with private JRE under Ubuntu Linux (Windows, very similar), to build both Windows and Linux installers from within Ubuntu.Create JRE's to bundle# Creating a directory where I will keep the JREs to bundle in various installers, mkdir ~/bundled_jrescd ~/bundled_jres# 1. Set up Linux JREcp -r /some/path/to/linux/jre linux_jre (if using Windows, use xcopy /E or Windows Explorer)cd linux_jre# pack200 itpack200 -J-Xmx1024m lib/rt.jar.pack.gz lib/rt.jar# zip itzip -9 -r -y ../linux_jvm.zip .cd ..# get unzipsfx for Linuxcp /usr/bin/unzipsfx unzipsfx.bin# concatenate sfx header with zip payload, this results in a self-extracting jvm executablecat unzipsfx.bin linux_jvm.zip & linux_jvm.bin (if using Windows, use copy /B unzipsfx.bin + linux_jvm.zip linux_jvm.bin)# 2. Set up Windows JREcp -r /some/path/to/windows/jre windows_jre (if using Windows, use xcopy /E or Windows Explorer)cd windows_jre# pack200 itpack200 -J-Xmx1024m lib/rt.jar.pack.gz lib/rt.jar# zip itzip -9 -r -y ../windows_jvm.zip .cd ..# get unzipsfx.exe for Windows, can find in ftp://ftp.info-zip.org/pub/infozip/win32/unz600xn.execp /path/to/unzipsfx.exe unzipsfx.exe# concatenate sfx header with zip payload, this results in a self-extracting jvm executable (Windows)cat unzipsfx.exe windows_jvm.zip & windows_jvm.exe (for Windows, use copy /B as above)At this point, we have a set of JVMs (not necessarily only Windows and Linux) which we can re-use for perpetuity, or update when significant new releases of the JRE becomes available.Set up build.xml for NBINow, open &netbeans-install-dir&/harness/nbi/stub/build.xml :Search for &-generate-bundles& target and replace the &create-bundle& call by the following set of conditional calls (changing /home/ernest to rather be your home dir of choice):
&!-- Linux installer --&&if property=&platform& value=&linux&&
&create-bundle root=&${output.dir}/registry-temp& platform=&${platform}&
target=&${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}&&
&component uid=&${main.product.uid}& version=&1.0.0.0.0&/&
&property name=&nbi.bundled.jvm.file& value=&/home/ernest/bundled_jres/linux_jvm.bin&/&
&/create-bundle&&/if&&!-- Solaris installer --&&if property=&platform& value=&solaris&&
&create-bundle root=&${output.dir}/registry-temp& platform=&${platform}&
target=&${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}&&
&component uid=&${main.product.uid}& version=&1.0.0.0.0&/&
&property name=&nbi.bundled.jvm.file& value=&/home/ernest/bundled_jres/linux_jvm.bin&/&
&/create-bundle&&/if&&!-- Windows installer --&&if property=&platform& value=&windows&&
&create-bundle root=&${output.dir}/registry-temp& platform=&${platform}&
target=&${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}&&
&component uid=&${main.product.uid}& version=&1.0.0.0.0&/&
&property name=&nbi.bundled.jvm.file& value=&/home/ernest/bundled_jres/windows_jvm.exe&/&
&/create-bundle&&/if&&!-- Mac installer --&&if property=&platform& value=&macosx&&
&create-bundle root=&${output.dir}/registry-temp& platform=&${platform}&
target=&${bundles.release.dir}/${bundle.files.prefix}-${platform}.${bundle.extention}&&
&component uid=&${main.product.uid}& version=&1.0.0.0.0&/&
&/create-bundle&&/if&(In the above, one could have multiple JVM's for multiple platforms, and just hook them up in the correct way as here. For example, in the Mac installer above we don't bundle any JVM.)
After doing this, generated installers should run off their bundled JVM's, but the application itself will not use this JVM, and search for a system JVM. To rather let it depend on this private JRE, continue …
Letting the application depend on the private JVM
Now, we edit ConfigurationLogic.java in &netbeans-install-dir&/harness/nbi/stub/ext/components/products/helloworld/src/org/mycompany/ConfigurationLogic.java to (a) extract the previously bundled JRE to a subdirectory called “jre” upon installation and (b) ensure it is also removed when the application gets uninstalled.
Add import statement:
import org.netbeans.installer.utils.system.launchers.LauncherR
At the end of install(), add:
File javaHome = new File(System.getProperty(&java.home&));File target = new File(installLocation, &jre&);try {&&& FileUtils.copyFile(javaHome, target, true); //FileUtils is one of the NBI core classes, already imported in ConfigurationLogic.java} catch (IOException e) {&&& throw new InstallationException(&Cannot copy JRE&,e);}&&&&&&& // set permissions:File binDir = new File(target, &bin&);for (File file : binDir.listFiles()) {&&& try {&&&&&&&&&&& file.setExecutable(true);&&& } catch (Exception ex) { ex.printStackTrace(); }}&&&&&&& // to add uninstaller logic:SystemUtils.getNativeUtils().addUninstallerJVM(new LauncherResource(false, target));
and at the end of uninstall(), but just before progress.setPercentage(Progress.COMPLETE);, add
File jre = new File(installLocation, &jre&);
if (jre.exists()) {
for (File file : FileUtils.listFiles(jre).toList()) {
FileUtils.deleteOnExit(file);
FileUtils.deleteOnExit(installLocation);
} catch (IOException e) {
Hook up a custom application configuration file, following Geertjan's
approach, but ensure that my.conf contains the line
jdkhome=&jre&which will be a relative path to the JRE that was installed by ConfigurationLogic's install() method.
Finally, to create our set of installers for various platforms and their respective bundled JRE's, right-click on your suite application, select &Package As&, then choose &Installers&. To create more compact installers (compressing .jar files using pack200), you can enable this by right-clicking, selecting Properties, select &Installer& and check &Use pack200 compression& - this has the effect that building the installers takes quite a bit longer due to the pack200 compression, but your users will be quite happy to have significantly smaller installers to download.
Many thanks to Geertjan Wielenga and Dmitry Lipin (the NetBeans Installer guru) without whom finding all the necessary ingredients would not have been possible!
Developers! Quickly and easily gain
access to the tools and information you need! Explore, test and combine our
data quality APIs at
– home to tools that save
time and boost revenue. Our APIs verify, standardize, and correct the Big 4 +
more – name, email, phone and global addresses – to ensure accurate delivery,
prevent blacklisting and identify risks in real-time.
Like This Article? Read More From DZone
<div class="dz-like"
{{ articles[0].views | formatCount}}
Opinions expressed by DZone contributors are their own.
Red Hat Developer Program
Red Hat Developer Program
Red Hat Developer Program
Melissa Data
Melissa Data
Red Hat Developer Program
Red Hat Developer Program
Melissa Data
Red Hat Developer Program
Red Hat Developer Program
Red Hat Developer Program
<div class="ad-gold row" ng-if="articles[1] && !articles[1].partner.isSponsoringArticle && width
0 || article.id != 517376" ng-include="'/static/article/article.html'">
{{ parent.views }} ViewsClicks一个C/S模式的JAVA聊天软件免费下载
资源大小:3.48 MB
月下载量:101次
软件属性:多国语言 免费软件
更新时间:
系统平台:WinVista/Win2003/WinXP/Win2000/Mac OS X/Mac OS 9/Mac OS 7.1/SCO Unix/FreeBSD/Linux/Win98/WinMe兼容软件
官方网站:暂无
用户推荐:
用户评分:
同类软件推荐:
C/S模式,JDK6 + netbeans6.1开发,第一版,带源码,供JAVA爱好者测试。希望把BUG发到我的邮箱:programmer.谢谢!&&&&
下载错误请点击举报
用户评分:
请打个分吧
请发表评论,字数不要少于10个哦~
小提示:您的评论对其他用户具有很重要的参考价值,请勿输入没有营养的点评内容,遇到问题请举报以方便我们及时处理。
1234567891011
12345678910
12345678910JRE【panorama吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0可签7级以上的吧50个
本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:17贴子:
Java&Runtime&Environment(Java运行环境),运行JAVA程序所必须的环境的集合,包含JVM标准实现及Java核心类库。
&&&&包括了JAVA虚拟机,一些核心类和相关的支持文件。是JDK的一部分(RUNTIME部分)。
&&&&jre为JavaRunTimeEnvirment的简称,JavaRuntimeEnvironment(包括JavaPlug-in)是Sun的产品,包括两部分:JavaRuntimeEnvironment和JavaPlug-inJavaRuntimeEnvironment(JRE)是可以在其上运行、测试和传输应用程序的Java平台。它包括Java虚拟机、Java平台核心类和支持文件。它不包含开发工具--编译器、调试器和其它工具。JRE需要辅助软件--JavaPlug-in--以便在浏览器中运行applet。
&&&&&&JavaPlug-in软件允许Javaapplet和JavaBeans组件在使用Sun的JavaRuntimeEnvironment(JRE)的浏览器中运行,而不是在使用缺省的Java运行环境的浏览器中运行。JavaPlug-in可用于NetscapeNavigator和MicrosoftInternetExplorer。
&&&&&&J2RE是Java2&Runtime&Environment,即Java运行环境,有时简称JRE。如果你只需要运行Java程序或Applet,下载并安装它即可。如果你要自行开发&Java软件,请下载JDK。在JDK中附带有JRE。注意由于Microsoft对Java的支持不完全,请不要使用IE自带的虚拟机来运行&Applet,务必安装一个JRE或JDK。&
贴吧热议榜
使用签名档&&
保存至快速回贴

我要回帖

更多关于 thinking in java答案 的文章

 

随机推荐