在Windows中编译的Java是否可以在Linux中使用? [英] Will Java compiled in windows work in Linux?

查看:113
本文介绍了在Windows中编译的Java是否可以在Linux中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Windows(Eclipse和Bluej)下使用Java程序时,我的Java程序处于工作状态.我将其压缩到一个罐子中,然后将其发送到我的红色帽子,然后爆炸.什么都行不通.它打破了最奇怪的事情,例如文本字段设置文本将不会显示,JPasswordfield刚刚消失,Java AWT ROBOT也死了……该清单还在继续,首先我认为这一定是我的Linux JRE已经过时了,但是我安装了最新的JRE,然后安装了JDK,但没有任何改进.我有一种想念我了解Java跨平台功能的感觉.我还尝试删除了所有功能和胆量,以查看发生了什么问题,但似乎每一秒钟都发生了问题,除了一些主要的GUI组件和大多数后端操作之外.基本上任何花哨的东西都会在我的脸上爆炸,例如将文本字段输入密码字段...

My Java program is in working order when i use it under Windows(Eclipse and Bluej). I compress it to a Jar and send it to my red hat and bang. nothing works. It breaks on the weirdest things, such as text field set text will not show, JPasswordfield just disappeared, Java AWT ROBOT dies too... the list goes on, first i thought it must be my Linux JRE is out of date, but i installed latest JRE then the JDK with no improvement at all. I have a feeling that i miss understood the Java cross plat ability. I also tried to remove all of my functions and guts to see what is breaking but it seems every second thing is breaking, other than the some of the major GUI components and most of the back end stuff. basically any thing that uses some thing fancy will blowup in my face, such as making a text field in to a password field...

这是我第一次发布;)请对新手好!

This is my first time posting ;) please be nice to the newbie!

谢谢!

已解决!!! 耶.问题解决了!!!这是因为未设置Java路径,所以我的GCC/GCJ代替了oracle java,即使我使用java -jar xxx.jar也是如此.所以我将java -jar xxx.jar的java目录路径放入其中,并且像一个超级按钮一样工作.除非您设置路径,否则必须手动执行

SOLVED!!! Yay. Problem solved!!! It was because my Java path isn't set, so my GCC/GCJ jumped in instead of my oracle java, even tho i used java -jar xxx.jar. so I put in the java directory path from of my java -jar xxx.jar and worked like a charm. unless you set the path, you have have to do this manually

/usr/java/jdk1.6.0_21/jre/bin/java -jar xxxxx.jar

/usr/java/jdk1.6.0_21/jre/bin/java -jar xxxxx.jar

java -version检查您的实际Java是否正在运行或是否仍为GCJ

java -version to check if your real java is running or if it s still GCJ

推荐答案

Linux用户通常使用gcj而不是Java运行Java程序.检查您使用的可执行文件是否正确.

Linux users often run java programs with gcj instead of java. Check that you use a correct executable.

这篇关于在Windows中编译的Java是否可以在Linux中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆