I have both the version of Jasmin 2.4 from the Jasmin SourceForge and the version of Jasmin 2.4 from the Soot project (at sable.mcgill.ca, labeled "jasminclasses"), and the Soot version (which I need) does not seem to be working properly.
I have made a simple compiler which compiles initially to Jasmin JVM assembly then uses Jasmin to assemble into JVM class files. I used to use the normal version of Jasmin from Jasmin's SourceForge site, and it was working great; everything compiled and ran correctly. Now I have started doing optimization using the Soot framework, and all that works great as long as I don't try to convert the optimized code back into a class file.
Since I'm using Soot now, I have to use Soot's version of Jasmin, which supports the JasminOutputStream that Soot uses. Soot's version of Jasmin does appear as though it's still supposed to be able to handle processing Jasmin files the "old fashioned" way, reading in a ".j" file instead of taking an input stream, but when I try (for the initial assemble before the optimization), the Soot version fails.
If I do
java -cp jasmin.jar jasmin.Main MyClass.j
I get output "Generated: MyClass.class" as expected.
If I do (where jasminclasses is the Soot version of Jasmin)
java -cp jasminclasses-2.4.0.jar jasmin.Main MyClass.j
I get output
MyClass.j:5: Warning - Syntax error.
.field public n
^
MyClass.j:5: Error - Couldn't repair and continue parse.
.field public n
^
MyClass.j: Found 2 errors`
Line 5 is just
.field public n I
Nothing incorrect about it, and as shown above, it compiles fine with the normal version of Jasmin.
For completeness, here's some more code around that point:
.source MyClass.j
.class public MyClass
.super AnotherClass
.field public n I
.method public <init>()V
aload_0
invokenonvirtual AnotherClass/<init>()V
return
.end method
Everything there is fine and assembles fine with normal Jasmin.
Does anyone know if the Soot version of Jasmin expects a different syntax? As with most stuff concerning Soot and Jasmin, there's not much on the web at all in the first place, let alone much on what I'm searching for, so my Googling isn't coming up with much.
Thank you in advance for any assistance offered, I'm really getting frustrated here. My next step is going to be to debug Soot's Jasmin package and see what it's doing in there and why it's failing, but I'm hoping I don't have to go that far for now just for this.
Related
While building the code getting package sun.security.action is not visible
Package sun.security.action is declared on module java.base, which does not export it to the unnamed module.
What should I do.
Kindly advice, Thanks in advance
Java 8 had no module system - everything is visible or just needs to get imported by archives in jdk (f.e. tools.jar).
Java 9 brought JMS and encapsulated some jdk classes.
In your case, see <JAVA_HOME>/lib/src.zip!/java.base/module-info.class:
exports sun.security.action to
java.desktop,
java.security.jgss,
jdk.crypto.ec,
jdk.incubator.foreign;
Your package isn't public but restricted to some other internal packages/modules.
There was a workaround by adding compiler option --add-exports=java.base/sun.security.action=ALL-UNNAMED at compile time to fix this limitation until version 16.
With version 17 and JEP 403 forget all hope:
It is not a goal to define new standard APIs to replace internal elements for which standard replacements do not yet exist, though such APIs could be suggested in response to this JEP.
Backwards compatibility and important frameworks have lower priority than jdk security - JCP makes strange decisions and works against the community sometimes -.-
I am busy trying to get the kinect working using Ubuntu 15.10. I have installed Libfreenect, OpenNI, NITE as well as SensorKinect.
I am able to run the programs in the OpenNI/Platform/Linux/Bin/x64-Release/ folder, for example Sample-NiUserTracker... However I have so far been unable to compile any of my own code.
I have tried to compile the examples in the Samples folder, for example SimpleViewer.java but I just get the following error:
SimpleViewerApplication.java:34: error: cannot find symbol
private SimpleViewer viewer;
^
symbol: class SimpleViewer
location: class SimpleViewerApplication
SimpleViewerApplication.java:66: error: cannot find symbol
app.viewer = new SimpleViewer();
^
symbol: class SimpleViewer
location: class SimpleViewerApplication
2 errors
I also tried to compile the C++ programs to no avail. Any suggestions on how to get something to compile would be awesome thanks.
Ok, so unfortunately you cannot just naively compile the example programs directly as they need to be linked with a whole bunch of files. One method of compiling without worrying about creating your own makefiles is to edit one of the existing files and go the OpenNI/Platform/Linux/Build and enter make. This will compile the example programs for you. and you can go to OpenNI/Platform/Linux/Bin/x64-Release and run the compile code.
Something that makes all this easier is to install PyOpenNI. Which enables you to code for the Kinect in glorious Python.
You can see full instructions at my github page https://github.com/RobbieJKatz/Kinect.
I wrote a simple program since my application doesn't work in mono. But even that simple program doesn't work and I understand is the ServiceHost constructor that doens't initialize its member (despite the fact that in mono source code you can see correct instructions).
I use mono/.net 4.0 ('mono --version' says 4.0.1, monodevelop 5.10, ubuntu 14.04.2 lts (32bit). I've tried to add the dll needed (ver 4.0) in the exe path, but nothing change.
That's the easy code I uses (in .Net no errors, in linux "invalid IL code in System.ServiceModel.ServiceHostBase:get_Credentials() : IL_0000 ret").
Imports System.Security.Cryptography.X509Certificates
Imports System.servicemodel
Public Interface IMyService
Sub DoSomething()
End Interface
Public Class CMyService
Implements IMyService
Public Sub DoSomething() Implements IMyService.DoSomething
Console.WriteLine("-dosomething-")
End Sub
End Class
Module Module1
Sub Main()
Dim h As New ServiceHost(GetType(CMyService), New System.Uri("net.tcp://127.0.0.1/10000"))
'if you check 'h', you'll see all its member set to Nothing :(
h.Credentials.ClientCertificate.Authentication.CertificateValidationMode = Security.X509CertificateValidationMode.None
End Sub
End Module
It is compiled succesfully but it throws an exception if executed.
As reported on source code, if you check members of variable 'h' I have all its items set to 'Nothing'.
I've tried using 32bit and 64bit exe compiled on Windows 7 using Xamarin Studio and Visual Studio (they work great on Windows, but same error in mono). I used in ubuntu the dll copied from Windows .net 4.0. Obviously the 64bit version doesn't even start. I even compiled inside linux using monodevelop 5.10 but I get the same runtime error.
I changed "System.Security.Criptography.X509Certificates" in "Mono.Security.Criptography.X509Certificates" changing also the dll, but in linux I have the same error invariably.
What can I do/check?
I'm stuck for 2 days :/
Thank you in advance.
Update 1
I converted the source code in c#, compiled with mcs, which suggests using also System.IdentityModel.dll. The application in c# works this way. I then update the project in monodevelop, it compile and I can do step-by-step in that IDE.
Then I updated the vb.net project, adding the "missing" dll. It compiles again correctly under monodevelop and the step-by-step debug stops again for the same reason.
Then I compiled using vbnc and it works. But I cannot debug inside the IDE.
I cannot understand why... I hope I must not convert all my source code to C# to see other "missing dll", and guess strange behavour of monodevelop...
Maybe I try to add the 'missing' dll in Windows 7, compile and see what linux says.
Update 2
Linux doesn't like the program compiled in Windows 7, it must be compiled in linux using vbnc by command line.
The problem was solved compiling the test program in linux with vbnc called by command line (for some unknown reason, monodevelop compile correctly only the c# version and not the equivalent version in vb.net).
So it's impossible to do a step-by-step debuggin using monodevelop and vb.net, but it works using c#.
During compilation in c# (using msc) a warning about a missing dll (System.Identity.dll) appears. Microsoft exe doesn't need it, mono does, but only msc tell you about it. I find info about it nowhere, so maybe it can be usefull to someone else... I was 3 days stuck on this :/
I am using Eclipse Kepler with jdk1.8.0.
I do not face any compilation problems in import statements related to java8 or collect construct. However I get the compilation issue in:- Dish::getName...it says.. Syntax errors on tokens, delete the tokens.
Just trying to run the following code:
List<String> dishNames = menu.stream()
.map(Dish::getName)
.collect(toList());
System.out.println(dishNames);
Dish is a java object with String property name.
I have installed JDK8, added the latest JRE in eclipse Java Build Path.
Java compiler compliance.
Any hints what something silly I am missing?
I think you missed installing support of java8 in eclipse kepler.
You can follow this link for detailed instructions.
https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler
I'm trying to work with the Java sample Database program from the CardScan SDK.
I am working with files located in Java/JNI and Java/Database. The program must be run with a 32 bit JRE. I was able to do so on a 64 bit machine by uninstalling Java and installing the 32 bit version, then re-adding the system path for Java. I can run the program and interface with a CardScan database file (.cdb) successfully by double clicking the SDKData.bat file, but when I open the source files for editing and edit the Java.library.path to include the required library (CRTK_JNI.dll), I get UnsatisfiedLinkErrors everywhere:
Exception in thread "main" java.lang.UnsatisfiedLinkError: sdkdata.CRTK.CRTK_Init([I)I
at sdkdata.CRTK.CRTK_Init(Native Method)
at sdkdata.CRTK.(CRTK.java:239)
at sdkdata.SDKData.(SDKData.java:97)
at sdkdata.SDKData.main(SDKData.java:643)
Java Result: 1
Presumably this is happening because the library is not loading properly.
What do I need to do to run and edit the program at full capacity (with all the native functions from CRTK_JNI in working order)?
Presumably this is happening because the library is not loading properly.
On the contrary. The library load is complete. You aren't getting that from a System.load()/loadLibrary() call, you are getting the error when calling your native method, the one that should have the signature:
package sdkdata;
public class CRTK
{
public native int CRTK_Init(int[]);
}
So it isn't there, or you have changed the signature without regenerating the .h and .c files, or you have manually mangled the declaration some other way.
Post your code.
To clarify, this Java sample program is officially unsupported by the CardScan API - it was a bad idea to try to use the API with an unsupported language relying solely on an experimental implementation. I ended up using one of the supported languages (Visual Basic) to work with the SDK; if anyone looking at this question happens to be struggling with using the CardScan API, here is my VB implementation on Github.