GradientPaint under Java 1.0
Hello all!
I have problem with painting. I need to draw rectangle for example with smooth change of one color to another. In Java 2 I do it in such way:
public void paint(Graphics g){
Graphics2D g2 = (Graphics2D)g;
GradientPaint p = new GradientPaint(5, 5, new Color(0, 0, 110), 50, 5, new Color(0, 110, 0));
g2.setPaint(p);
g2.fillRect(0, 0, 80, 20);
}But I need code that works in all JRE, including Microsoft VM.
So how to creatre manually smooth change of color?
Well, i'm not going to do all the work for you ;-) but here are some tips:
First of all, make a method to draw a filled square using the drawLine method.
Then figure out how to make colours shift, in the way you want.
Colour exist out of 3 base colours, Red, Blue and Green, they can all have values from 0 to 256. combining them, makes any colour.
Make a method to make colours shift in steps to another colour, by shift up, or down the values of the colour(plenty of example code out there... lookie @ google)
Then make the method applicable in the drawline method...
idea for header of the colour method
public Color determineColor(int howMuchSteps,int currentStep, Colour startColour, Color endColour) {
// Colour calculation here
}Anyways, that's the only help I can offer.
Michael
Similar Messages
-
Help tracking down a file descriptor leak under java 6
I have a large application I work on that runs fine under java5 (apart from possibly the latest update) but running under java 6 results in file descriptors used for TCP sockets being leaked.
I'm testing this under FreeBSD 6 (both i386 and amd64) using diablo JDK and a port build jdk-1.6.0.3p3 but I have had reports from other users of exactly the same issue under various linux distributions. There are some reports that going back as far as 1.6.0b5 will resolve the issue but no later version works and a few reports that the latest 1.5 updates have the same issue.
This application is using standard IO so Socket/ServerSocket and occasionally SSLSocket, no NIO is involved. Under the problem JDKs it will run for a while before available FDs are exhausted and then fall over with a "too many open files" exception. So far I have been unable to recreate the situation in a simple testcase and the fact it works fine under earlier JDKs is really causing me issues with deciding where to look for the issue.
Using lsof to watch the FDs that are leaked I see a steadily increasing number shown in the following state:
java 23438 djb 54u IPv4 0xffffff0091ad02f8 0t0 TCP *:* (CLOSED)
java 23438 djb 55u IPv4 0xffffff0105aa45f0 0t0 TCP *:* (CLOSED)
java 23438 djb 56u IPv4 0xffffff01260c15f0 0t0 TCP *:* (CLOSED)
java 23438 djb 57u IPv4 0xffffff012a2ae8e8 0t0 TCP *:* (CLOSED)
If these were showing as say (CLOSE_WAIT) then I would understand where they are coming from but as far as I understand the above means the socket has been fully closed but the FD simply hasn't been released. I'm not an expert on the TCP protocol however so I may be wrong here.
I did try making the application set SoLinger(0,true) on all sockets which of course made all connecting clients think the connection was aborted rather than gracefully closed but even with this setting the FD leak persisted.
I've gone as far as looking at what I think are the relevant parts of the src for both JDK versions I am using but there are very few changes and nothing that obviously looks linked.
I'm fully prepared to spend a lot of time looking into this and I'm sure I'd eventually find the cause but if anyone here already knows what the answer may be or can simply give me a nudge in the best direction to look I would be very grateful.After weeks of dancing around the issue for weeks, we narrowed it down to garbage collection. If we put System.gc() to run periodically , file descriptors get garbage collected properly . I've tried playing with the settings by using XX:+UseConcMarkSweepGC which seems to help a great deal while system is under stress. However when there is light activity.. the file descriptors grow again and eventually bring everything down.
Any clues ? is there any way to make gc to perform full collection more often ?
pls whelp !!! -
JavaMediaFrameWork fails under Java 1.4 but runs under Java 1.3
I have an JMF application running under webstart. It runs ok in Java 1.3
Now I am trying to get ti to run under Java 1.4. The attached error is rather useless,
but by guess at what is happening is that the JMF control has some .awt. stuff included
but that Java 1.4 emulates .awt. in swing. But something was not set and the default does not
work.
This error messages does not appear in the 1.3 run
Any suggestions would be greatly appriatated.
1.4 result:
mg version 2.1.1a
player created com.sun.media.content.unknown.Handler@3a1834
ctr com.sun.media.PlaybackEngine$BitRateA@4a9a7d
ctr com.sun.media.BasicJMD[panel0,0,0,512x200,invalid,layout=java.awt.BorderLayout]
duration? javax.media.Time@6b5666 sec = 9.223372036854776E9
time unknown javax.media.Time@754699
will realize the player
realize
javax.media.TransitionEvent[source=com.sun.media.content.unknown.
Handler@3a1834,previous=Unrealized,current=Realizing,
target=Realized]
start smxBADS
bass start
Exception occurred during event dispatching:
java.lang.NullPointerException
at javax.swing.plaf.metal.MetalLookAndFeel.getControlInfo(Unknown Source)
at javax.swing.plaf.metal.MetalScrollButton.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintWithBuffer(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception occurred during event dispatching:
java.lang.NullPointerException
at javax.swing.plaf.metal.MetalLookAndFeel.getControlInfo(Unknown Source)
at javax.swing.plaf.metal.MetalScrollButton.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintWithBuffer(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
realize done
panel found java.awt.Panel[panel1,0,0,0x0,invalid] java.awt.Panel[panel2,4,216,292x30,layout=java.awt.FlowLayout]
press a button
Exception occurred during event dispatching:
java.lang.NullPointerException
at javax.swing.plaf.metal.MetalLookAndFeel.getControlInfo(Unknown Source)
at javax.swing.plaf.metal.MetalScrollButton.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintWithBuffer(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception occurred during event dispatching:
java.lang.NullPointerException
1.3 result
mg version 2.1.1a
player created com.sun.media.content.unknown.Handler@354749
ctr com.sun.media.PlaybackEngine$BitRateA@5b484d
ctr com.sun.media.BasicJMD[panel3,0,0,512x200,invalid,layout=java.awt.BorderLayout]
duration? javax.media.Time@46d228 sec = 9.223372036854776E9
time unknown javax.media.Time@f7386
will realize the player
realize
javax.media.TransitionEvent[source=com.sun.media.content.unknown.
Handler@354749,previous=Unrealized,current=Realizing,
target=Realized]
start smxBADS
bass start
javax.media.DurationUpdateEvent[source=com.sun.media.content.unknown.Handler@354749,duration=javax.media.Time@55c0f9
javax.media.Time@55c0f9
javax.media.RealizeCompleteEvent[source=com.sun.media.content.unknown.Handler@354749,previous=Realizing,current=Realized,target=Realized]
realized complete
prefetch
realize done
controlComp com.sun.media.ui.DefaultControlPanel[,0,0,74x21,invalid,layout=java.awt.BorderLayout]
add controlComp 21 java.awt.Panel[panel4,10,-12,258x47,invalid]
javax.media.TransitionEvent[source=com.sun.media.content.unknown.Handler@354749,previous=Realized,current=Prefetching,target=Prefetched]
start smxBADS
bass start
running ok from here onI have also experienced buggy problems with 1.4 from things that work perfectly well in 1.3. I've informed Sun about some of my bugs and of course they're having trouble reproducing them, but what I'm going to do is just stick with 1.3 until 1.5 comes out, and then give that a try. If 1.5 is as buggy as 1.4, then perhaps I'll simply dive into C++ and leave Java behind.
-
Is ABAP going to lie down under java ?
Hi,
rumours are going on that Java will be the major programming language for SAP in future, though abap will not die, as all those web article say, but its defintely going to lie down under, java,
is it not additional burden for a developer being in sap, doing ABAP+ java, where in he can fully devote to java, and then choose many openly available jobs in different domains.................................
its like if we want to be in sap, we learn ABAP would be good enough to program, now along with ABAP, have to learn JAVA that too at very deep level,
then instead learn Java and take jobs in other domains.............................
whats your comments botn on java overtaking abapHello, this was my favorite lunch-time topic when I started doing SAP three years ago. And nothing has changed during that years. Except that most of the SAPguys started to hate Java Webdynpro:)) And ESS/MSS is being rewritten to ABAP WD etc. Is that enough to prove there will be no Java revolution in next five years. There will be enough ABAP work for everybody for next 5 to ten years for sure.
Regards Otto, Czech Republic
p.s.: But there are different trends in different parts of this planet... -
Hello Community
Since i had installed the newest version of Java several Java applications urge me to install the older Java 6.
I wonder why since the jar included in the package runs fine under Java 8 as expected.
regards volkerThere are two different Java distributions for end users: one distributed by Apple, and one by Oracle. They don't overlap in function.
The Apple Java runtime (version 6) is needed to run bare jar files and older standalone Java applications. Newer Java applications have the Java runtime built in, and don't depend on Apple's Java.
The Oracle Java runtime (version 8 or later) is a web plugin only. It's used to run Java applets on web pages and Java WebStart applications. You can determine whether it's installed and up to date by looking for a preference pane named Java in System Preferences. If it's present, open it. It will launch the "Java Control Panel." Select the Update tab. -
Two commands in the report using the same parameter - fail under Java
I have a report that contains 2 SQL commands.
Both of these commands use one parameter X of type Number in their 'WHERE' clause.
When i'm viewing the report in CR 2008, i'm asked for a value of this parameter and all data is filled in the report - OK
The problem occurs when the same report is printed through Crystal Java Runtime:
Report is printed without data! - it's empty.
What we noticed in the debug information thrown by the Crystal libraries is that parameter value is set only in one of these commands:
Original statement 1:
select a.something
from ANM_T a
where a.anmid = {?PARAMETER01Id}
Original statement 2:
SELECT * from ANM_T a
WHERE a.anmid={?PARAMETER01Id}
OUTCOME of Statement 1:
select a.something
from ANM_T a
where a.anmid = 0
OUTCOME of Statement 2:
SELECT * from ANM_T a
WHERE a.anmid=9825
In above example we may see that crystal set the value only in the second statement - first one got 0 - i suspect its some default value.
Parameter in the Java code is set in the right way. In case of using only one statement it works. If we use two separate parameters (whose values are equal ) it also works.
// we have also the loop over the parameters
ParameterFieldController paramFieldController =
report.getDataDefController().getParameterFieldController();
paramFieldController.setCurrentValue( "", paramName, paramValue );
What is strange for me is that Crystal Reports enables to use the same parameter in two commands but if you edit one of them you may change the type of this parameter for a command ( for example from Number to String) but the parameter type in the second command remains unchanged ( it's strange because in my opinion it is the same parameter). In the Field Explorer under the Parameter Fields i still see one parameter of type used in the second command.Hello all,
We have prepared some sample code to illustrate the issue.
We have modified the sample application (Link: [http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/c07fec3e-3e11-2c10-1991-8c0fb0b82b75]) to that it also changes the parameter value. Parameter is used in two commands saved in report.
The code changing the parameters value looks like this:
private static void changeParameters(ReportClientDocument reportClientDoc) throws ReportSDKException {
DataDefController dataDefController = reportClientDoc.getDataDefController();
Fields fields = dataDefController.getDataDefinition().getParameterFields();
for( int i = 0; i < fields.size(); i++ ){
Field field = (Field)fields.getField( i );
if( field.getKind() == FieldKind.parameterField ){
setParameter( ((ParameterField)field).getName(), "9825" , reportClientDoc);
private static void setParameter( String paramName, String paramValue, ReportClientDocument document ) throws ReportSDKException {
ParameterFieldController paramFieldController =
document.getDataDefController().getParameterFieldController();
paramFieldController.setCurrentValue( "", paramName, paramValue );
We have tried the following codes to change the connection info used in commands:
Attempt 1
Tables tables = databaseController.getDatabase().getTables();
//Set the datasource for all main report tables.
for (int i = 0; i < tables.size(); i++) {
ITable table = tables.getTable(i);
//Keep existing name and alias.
table.setName(table.getName());
table.setAlias(table.getAlias());
//Change connection information properties.
IConnectionInfo connectionInfo = table.getConnectionInfo();
//Set new table connection property attributes.
connectionInfo.setAttributes(propertyBag);
//Set database username and password.
//NOTE: Even if these the username and password properties don't change when switching databases, the
//database password is *not* saved in the report and must be set at runtime if the database is secured.
connectionInfo.setUserName(DBUSERNAME);
connectionInfo.setPassword(DBPASSWORD);
connectionInfo.setKind(ConnectionInfoKind.SQL);
table.setConnectionInfo(connectionInfo);
//Update old table in the report with the new table.
databaseController.setTableLocation(table, tables.getTable(i));
//databaseController.setTableLocation(tables.getTable(i), table);
Attempt 2
newConnectionInfo.setAttributes(propertyBag);
connectionInfo.setUserName(DBUSERNAME);
connectionInfo.setPassword(DBPASSWORD);
//preserve subreport links
SubreportController src = doc.getSubreportController();
Map<String, SubreportLinks> linkMapper = new HashMap<String,SubreportLinks>();
for(String subreportName : src.getSubreportNames()){
linkMapper.put(subreportName,
(SubreportLinks) src.getSubreportLinks(subreportName).clone(true));
//If this connection needed parameters, we would use this field.
Fields<IParameterField> pFields = doc.getDataDefController().getDataDefinition().getParameterFields();
replaceConnectionInfos(doc.getDatabaseController(), newConnectionInfo, pFields);
IStrings strs = src.getSubreportNames();
Iterator<String> it = strs.iterator();
while (it.hasNext()) {
String name = it.next();
ISubreportClientDocument subreport = src.getSubreport(name);
pFields = subreport.getDataDefController().getDataDefinition().getParameterFields();
replaceConnectionInfos(subreport.getDatabaseController(), newConnectionInfo, pFields);
//reconnect subreport links since when using replaceConnection links are erased
for(String subreportName : src.getSubreportNames())
src.setSubreportLinks(subreportName, linkMapper.get(subreportName));
private static void replaceConnectionInfos(DatabaseController aDc, IConnectionInfo aNewConnInfo, Fields<IParameterField> aParameterField) throws ReportSDKException {
ConnectionInfos cis = aDc.getConnectionInfos(null);
for (IConnectionInfo oldConnInfo : cis)
aDc.replaceConnection(oldConnInfo, aNewConnInfo, aParameterField, DBOptions._useDefault
+ DBOptions._doNotVerifyDB);
In both cases, the observed problem occurred. In one query the parameter was set properly, while on the other it was set to 0 (or empty string in case of string parameters). What is more, no data appeared on the print.
Do you happen to know the reason of this issue?How can we fix the problem?
Best regards
Mateusz Błaż -
ReportViewer.jar running under Java Version 6 Update 17
Hello,
Does anyone know how to resolve the missing icons issue when running the ReportViewer.jar tool under the above Java version. Under update 16 the viewer had all the correct buttons and icons and worked great. Since the upgrade to Java update 17 the icons have disappeared from the viewer. The buttons are still there but no icons.
I am using Crystal Reports XI developer edition with the latest service packs on Windows 7.
Regards
AdrianThis solution worked for me. All settings and bookmarks are intact. Thank you.
-
How to print PDF under Java control
Hi, all - thank you for reading this message.
I'm working with Java 1.4.2_12 and Tomcat but planning to migrate upward Real Soon Now. We are running on Windows Server 2003 (customer's choice).
My application, using iText, creates a PDF, which comprises a new coversheet plus some existing PDFs appended. The new PDF is needed for archival. This part works OK.
Now, still in my Java app, I would like to print the new PDF, to a printer chosen in my code. At present I have only PCL and basic PS (2?) capable laser printers, mostly HPs, available and these are all networked - not local - printers.
I have tried some things using PrintService and this cannot find any PDF printers from the server, though for comparison it did correctly find some PostScript capable devices. Attempts to actually print have resulted in garbage, with the printer obviously mangling the PDF over several trees-worth of paper, if not stopped.
Has anyone else managed to 'filter' a PDF (under program control) and send it to a regular, networked printer, such as I have described?
Can anyone confirm that a PS 3 capable printer would handle a PDF direct and if so what DocFlavor would be appropriate?
Sorry if this is a trivial issue but I have spent quite some time on it and would appreciate any input.
Thanks - Edwin
Message was edited by:
EdwinBoltonjPDFPrint by Qoppa Software. It's a 100% java library to print PDF documents.
-
How to find out the number of threads created under java vm at runtime
our application seems to have hit the max number of threads that can be created under vm and the vm will just hang after that. that behavior seems to be consistent from an article that I read earlier.
I wonder any way that java app can find out the number of threads currently created under vm?
thanks in advance!If you are not starting an extra thread group you can use the Thread.activeCount method. But this willnot return all the threads, as there are some jvm threads, i.e. garbage collector. Also if you are running on a Unix type operating system then you can send a signal to the jvm to give you a thread dump, i think the signal is sighup.
If the application is hanging i would of thought that you have a deadlock situation rather then the JVM not being able to create new threads, roughly how many threads should be running ?? -
Where to find out the log file under java developer role
Hi,
I have some application created in NWDS. While running it after the PAR deployment and all. some exception is thrown. the exception iD is given. I was trying to find out wher the log files are located in the portal so that I can analyze the exception.
I think it is under the java developer role....but under that......I checked the log viewer tool and all.....but exactly where the log files would be located. so that with the exception ID , I can search and find out the log for the particular exception.
any ideas?
Thanks in advance.Hi Steelman,
Use the search option in log viewer for this purpose. In the server it would be located in
<i>usr/sap/sid/jc00/cluster/server0/logs</i>
Hope this helps.
Regards
Bharathwaj -
How do you enable a DRWTSN32 user.dmp under Java console ?
I'm experiencing an exception violation in a C module invoked from a Java class. The Java console shows the stack and all, but I need the user.dmp from DRWTSN32 and one is not being generated. I have initialized DRWTSN32 -i and have set my appropriate settings under DRWTSN32 and have also disabled the Java console, but I'm still not getting the nofification alert (from DRWTSN32) and no user.dmp. I'm running Windows NT with JRE 1.3.1.
Any idea how I can get the user.dmp generated ?Actually, the C module is abending. The Java console provides:
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x96434ae
Function name=chekmod along with the library dll name and the stack trace.
So what I need to determine is how to get the user.dmp that should occur from DRWTSN32.
I've even disabled the java console, but I still get the stack trace and no user.dmp. -
Executing native library under Java - shell script problem
I am running a Java application on the command line bash shell. I have a few JAR files in the directory and a few native libraries. When I run the application using the command line, all works fine. This is the command I use:
java -classpath MyGame.jar:log4j-1.2.16.jar:jme/jme-colladabinding.jar:jme-audio.jar:jme-awt.jar:jme-collada.jar:jme-editors.jar:jme-effects.jar:jme-font.jar:jme-gamestates.jar:jme-model.jar:jme-ogrexml.jar:jme-scene.jar:jme-swt.jar:jme-terrain.jar:jme.jar:jogl/gluegen-rt.jar:jogl/jogl.jar:jorbis/jorbis-0.0.17.jar:junit/junit-4.1.jar:lwjgl/jinput.jar:lwjgl/lwjgl.jar:lwjgl/lwjgl_util.jar:lwjgl/lwjgl_util_applet.jar:swt/windows/swt.jar:jbullet/jbullet-jme.jar:jbullet/asm-all-3.1.jar:jbullet/jbullet.jar:jbullet/stack-alloc.jar:jbullet/vecmath.jar:trove-2.1.0.jar:sceneMonitor/jmejtree_jme2.jar:sceneMonitor/propertytable.jar:sceneMonitor/scenemonitor_jme2.jar:sceneMonitor/sm_properties_jme2.jar -Djava.library.path="lwjgl/native/linux" -Xmx1024m -Xms768m -ea com.mygame.MainThis works fine and the application starts up as expected. LWJGL native library is loaded in and works fine as expected.
The problem occurs when I try to run this command via the shell using a shell script. Here is my script:
#!/bin/bash
# Set the minimum and maximum heap sizes
MINIMUM_HEAP_SIZE=768m
MAXIMUM_HEAP_SIZE=1024m
if [ "$MYAPP_JAVA_HOME" = "" ] ; then
MYAPP_JAVA_HOME=$JAVA_HOME
fi
_JAVA_EXEC="java"
if [ "$MYAPP_JAVA_HOME" != "" ] ; then
_TMP="$MYAPP_JAVA_HOME/bin/java"
if [ -f "$_TMP" ] ; then
if [ -x "$_TMP" ] ; then
_JAVA_EXEC="$_TMP"
else
echo "Warning: $_TMP is not executable"
fi
else
echo "Warning: $_TMP does not exist"
fi
fi
if ! which "$_JAVA_EXEC" >/dev/null ; then
echo "Error: No Java environment found"
exit 1
fi
_MYAPP_CLASSPATH="MyGame.jar:log4j-1.2.16.jar:jme/jme-colladabinding.jar:jme-audio.jar:jme-awt.jar:jme-collada.jar:jme-editors.jar:jme-effects.jar:jme-font.jar:jme-gamestates.jar:jme-model.jar:jme-ogrexml.jar:jme-scene.jar:jme-swt.jar:jme-terrain.jar:jme.jar:jogl/gluegen-rt.jar:jogl/jogl.jar:jorbis/jorbis-0.0.17.jar:junit/junit-4.1.jar:lwjgl/jinput.jar:lwjgl/lwjgl.jar:lwjgl/lwjgl_util.jar:lwjgl/lwjgl_util_applet.jar:swt/windows/swt.jar:jbullet/jbullet-jme.jar:jbullet/asm-all-3.1.jar:jbullet/jbullet.jar:jbullet/stack-alloc.jar:jbullet/vecmath.jar:trove-2.1.0.jar:sceneMonitor/jmejtree_jme2.jar:sceneMonitor/propertytable.jar:sceneMonitor/scenemonitor_jme2.jar:sceneMonitor/sm_properties_jme2.jar"
_VM_PROPERTIES="-Djava.library.path=\'lwjgl/native/linux\'"
_MYAPP_MAIN_CLASS="com.mygame.Main"
$_JAVA_EXEC -classpath $_MYAPP_CLASSPATH $_VM_PROPERTIES -Xmx${MAXIMUM_HEAP_SIZE} -Xms${MINIMUM_HEAP_SIZE} -ea $_MYAPP_MAIN_CLASSThe shell script is in the same directory as the JAR files (the same directory where I ran the Java command above). When I execute the shell script ( sh MyGame.sh ), I get the UnsatisfiedLinkError message:
14-Feb-2011 19:46:28 com.wcg.game.DefaultUncaughtExceptionHandler uncaughtException
SEVERE: Main game loop broken by uncaught exception
java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:82)
at org.lwjgl.Sys.<clinit>(Sys.java:99)
at org.lwjgl.opengl.Display.<clinit>(Display.java:130)
at com.jme.system.lwjgl.LWJGLDisplaySystem.setTitle(LWJGLDisplaySystem.java:118)
at com.wcg.game.WcgStandardGame.initSystem(WcgStandardGame.java:287)
at com.wcg.game.WcgStandardGame.run(WcgStandardGame.java:185)
at java.lang.Thread.run(Thread.java:662)I don't understand what I am doing wrong. I am executing the exact same command via a shell script and it is not working. Any ideas, solutions, most welcome.
I am running Linux Mint Debian 201012, Linux mint 2.6.32-5-amd64 #1 SMP Thu Nov 25 18:02:11 UTC 2010 x86_64 GNU/Linux. JDK is 1.6.0_22 64-bit. I have 64-bit .so files in the correct place too.
Thanks
RizThanks for the replies guys/gals.
I have modified the script and echoed my command that should be running under the shell script, it is:
java -classpath WcgFramework.jar:WcgPocSwordplay.jar:log4j-1.2.16.jar:jme/jme-colladabinding.jar:jme-audio.jar:jme-awt.jar:jme-collada.jar:jme-editors.jar:jme-effects.jar:jme-font.jar:jme-gamestates.jar:jme-model.jar:jme-ogrexml.jar:jme-scene.jar:jme-swt.jar:jme-terrain.jar:jme.jar:jogl/gluegen-rt.jar:jogl/jogl.jar:jorbis/jorbis-0.0.17.jar:junit/junit-4.1.jar:lwjgl/jinput.jar:lwjgl/lwjgl.jar:lwjgl/lwjgl_util.jar:lwjgl/lwjgl_util_applet.jar:swt/windows/swt.jar:jbullet/jbullet-jme.jar:jbullet/asm-all-3.1.jar:jbullet/jbullet.jar:jbullet/stack-alloc.jar:jbullet/vecmath.jar:trove-2.1.0.jar:sceneMonitor/jmejtree_jme2.jar:sceneMonitor/propertytable.jar:sceneMonitor/scenemonitor_jme2.jar:sceneMonitor/sm_properties_jme2.jar -Djava.library.path="lwjgl/native/linux" -Xmx1024m -Xms768m -ea com.mygame.MainI am more confident that now the shell script should be fine (I am a shell script noob) because this very command if I copy from terminal and paste into the terminal, runs the application no problem at all. But I am amazed that it is still not working. I must be doing something obviously wrong. :-(
I used the code as suggested:
_VM_PROPERTIES='-Djava.library.path="lwjgl/native/linux"'I am stumped!? :-(
Thanks for help. -
Executing the .bat file under java
Hi,
I have a batch file which will do some useful stuffs
like compilation of jar file, deploying the ejb's under
WebLogic container etc.
I called the batch file under windows environment, it
used to display the console without any processing
on it.But similar stuff with shell script works fine on
Linux OS.
How do I execute the batch file from Runtime?We use
Runtime.getRuntime().exec("c:\\path\\to\\batch.bat");
If that doesn't work, try "cmd /c c:\\path\\to\\batch.bat".
You might have to capture the output from the process from Java to make sure it works correctly. And yes, the downside is that it will bring up an empty command prompt when you run it under Windows 95,98,Me... not a lot you can do about that, it's avoidable under NT,2K,XP with a bit of trickery though. -
Greetings,
I have the need to create a Java program using SWING or using a web interface with JSP/Servlets however one of the program modules requires the input of a C code that needs to be run.
Is this possible?
For example, In the module I have a TextArea where I input something like
#include <stdio.h>
printf("Hello");
(I'm not a C programmer just say this as reference)
And Java will compile it in C and execute it.
Is this possible in both enviroments? Application AND/OR WEB using JSP/Servlets?
Thank you.Simple.
java.lang.Runtime.exec() returns a java.lang.Process object.
With this object you can get an inputstream returned from [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html#getInputStream()]Process.getInputStream() call that will allow you to read all data outputed from the process.
With that data rread, you can then output it in a Frame or a HTML page or whatever. -
Exporting Crystal Report 2008 under java
I'm in the process of converting a desktop application from VB6 to Java
I am also upgrading Crystal Reports from version CR10 to CR2008.
The application executes and exports the report to a PDF file.
I cannot get past the error :
.getPrintOutputController().export(ReportExportFormat.PDF);
Am I using the correct CR packages? All examples I've found refer
to CR XI version or lower
Below is the code supposedly used to execute and create the output file.
import com.crystaldecisions.reports.sdk.*;
import com.crystaldecisions.reports.sdk.*;
import com.crystaldecisions.sdk.occa.report.exportoptions.*;
import com.crystaldecisions.sdk.occa.report.lib.*;
//Java imports.
import java.io.*;
* @author wr0848
public class JRCExportReport {
static final String REPORT_NAME = "Employees.rpt.rpt";
static final String EXPORT_FILE = "C:\\myExportedReport.pdf";
public static void main(String[] args) {
try {
//Open report.
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(REPORT_NAME, 0);
//NOTE: If parameters or database login credentials are required, they need to be set
before.
//calling the export() method of the PrintOutputController.
//Export report and obtain an input stream that can be written to disk.
//See the Java Reporting Component Developer's Guide for more information on the
supported export format enumerations
//possible with the JRC.
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
//Release report.
reportClientDoc.close();
//Use the Java I/O libraries to write the exported content to the file system.
byte byteArray[] = new byte[byteArrayInputStream.available()];
//Create a new file that will contain the exported result.
File file = new File(EXPORT_FILE);
FileOutputStream fileOutputStream = new FileOutputStream(file);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream
(byteArrayInputStream.available());
int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
byteArrayOutputStream.write(byteArray, 0, x);
byteArrayOutputStream.writeTo(fileOutputStream);
//Close streams.
byteArrayInputStream.close();
byteArrayOutputStream.close();
fileOutputStream.close();
System.out.println("Successfully exported report to " + EXPORT_FILE);
catch(ReportSDKException ex) {
ex.printStackTrace();
catch(Exception ex) {
ex.printStackTrace();Download and use the Crystal Reports for Eclipse CRJ runtime:
[http://www.businessobjects.com/campaigns/forms/downloads/crystal/eclipse/datasave.asp]
Sincerely,
Ted Ueda
Maybe you are looking for
-
I have a very large music library 500 GB on an external drive how do I get it on my brand new iMac intel
-
"Adobe Premiere Pro CC 2014.1 has stopped working"
I'm on a Windows HP ProDesk PC trying to open a file from my external hard drive that I created on my Macbook Air laptop. When I open the file, I'm able to get past the window that says it's locating the media, it loads the sequence timeline, it load
-
Last night as I downloaded some pictures from an SD card, iPhoto appears to have crashed. Only the photos from the last download are there. Albums, events, keywords, photos are all gone. When I go to 'all images' in the Finder it seems that my pictur
-
How to upgrade ipad2 to 5.0 os
Trying to upgrade and don't how how to get started.
-
Linksys WRT54GL not saving settings
Hello all just got a WRT54GL today and the wired part works as well as the config from the webui ... the proble is my router wont save any wireless settings ... for example ill change my SSID and hit save changes ... it will say it is successful ...