Search java

173985 results
3

votes
3

answer

Java, Java VM, Java Platform, [closed]

Can someone explain the differences of the Java Platform SE (6), Java, Java VM, etc.? Thanks.
mk12
4

votes
1

answer

Java JNDI Name java:/

I'm following the tutorial: https://docs.oracle.com/javase/tutorial/jndi/index.html My adventure started while setting a JNDI name for a datasource with the WildFly application server. The name started with 'java:/'. I was curious on what it was and how it worked. I have Apache Directory LDAP server...
Brian
8

votes
1

answer

Java -> Clojure -> Java

I am trying to use Clojure as a scripting language from a host Java program. The idea being that the end user will be able to write Clojure scripting code that will call a domain-specific Java API. At runtime, the host Java program will evaluate the end-user's Clojure script (which will in turn call...
Marcus Junius Brutus
1

votes
1

answer

Java typed i18n (java)

I'd like to know if it's possible (and with which tooling) to do typesafe i18n in Java. Maybe it's not clear so here are some details, assuming we use something based on MessageFormat 1) Translate using typesafe parameters I'd like to avoid having an interface like String translate(Object key,Object...
Sebastien Lorber
2

votes
2

answer

Java meaning of .java~

By typing jar -tf myJar.jar MyProject I get in the file list, besides the normal .java and .class files, also a .java~ file. I have read googling it around that it is due to some other incomplete version of the file.java. If so, How can I go ahead and remove those files? since in the real folder the...
Rollerball
1

votes
3

answer

JAVA: Basic java logic

I have been working with java just a little, but there is these small logic things that I seem to never understand and I'll give an example right away. I currently have this code: class test { public static void main(String[] args) { ST st; st = new ST(); for (int i = 0; !StdIn.isEmpty(); i++) { Str...
BrianLaguana
2

votes
2

answer

Java Calculator errors java scanner

I'm trying to make a simple calculator and need help with somthing import java.util.*; import javax.swing.*; public class HiWorld { public static void main(String[] args) { System.out.println('Type 2 Numbers'); Scanner input1 = new Scanner(System.in); Scanner input2 = new Scanner(System.in); answer...
user3546834
3

votes
2

answer

Java 8 and Java time

I know the default Java library for Codename One is now Java 8 and I am also compiling locally with Java 8. I am trying to use the new java.time API added in Java 8 (Tutorial). I see the following error at compile time: : error: package java.time does not exist Are java.time classes not included i...
3lix
4

votes
3

answer

Java compiler in java [duplicate]

Possible Duplicate: implementing a compiler in “itself” I was reading about the Java compiler and realized that it was written in Java. How can that be possible? I mean, isnt this like 'Chicken and egg' problem? How can we write the compiler in the same language?
Chander Shivdasani
0

votes
1

answer

Java- Trouble understanding java threads

I have been working with threads and i came upon a piece of code which was hard for me to understand, i have been trying to search on google but come up with nothing that could really make me comprehend it. This is the code. So the hard part to understand about this for me is two lines. its index =...
Ziad Younis
1

votes
2

answer

parse java string in java

I want to parse java code using java. problem is , when I pass the java code to parse method,it does not take it as string.How do I escape the code to be parsed public class JavaParser { private int noOfLines; public void parse(String javaCode){ String[] lines = javaCode.split('[\r\n]+'); for(String...
vishesh
1

votes
5

answer

Monitoring Java from within Java

I want to write a simple visualization of a Java program by displaying the program's method calls as branches of a tree. This could be done quite simply by having the program itself tell the visualization what it is doing, but I want to be able to do this with any Java method/class and not just the...
Marc Müller
-2

votes
5

answer

Parsing Java code with Java

Is it possible to parse some Java code with a regex? So let's say I want a list of the int variables from this: int abc1 = 1; int abc2 = abc1 + 1; int abd3 = abc1 + abc2; And I want to put these into an ArrayList. So something like this: private void parse(String s){ List variables = new ArrayList()...
FabianCook
22

votes
3

answer

java streams in Java 7

My question may be too broad and probably the answer is a simple NO, but I have to ask. Is there any equivalent implementation of (Java 8) streams* in Java 7? I am familiar with (Java 8) streams but my project requirement is to use Java 7. *Not to be confused with inputStream and outputStream.
Athafoud
3

votes
2

answer

java -version vs java -fullversion

What are the differences between java -version and java -fullversion? The two do not seem to line up on my machine. C:\Users\kmort>java -fullversion java full version '1.8.0_20-b26' C:\Users\kmort>java -version java version '1.8.0_25' Java(TM) SE Runtime Environment (build 1.8.0_25-b18) Java HotSpot...
kmort
1

votes
4

answer

Java Multiple comparision in java

Pardon me if this is a stupid question.. I was wondering if there is any support for following comparison in Java: (a, b, c .... != null) in place for : (a != null && b != null && c != null && d ! null and so on ..) I was trying to make code more readable as my code which is almost unreadable due...
Ankur Saran
2

votes
7

answer

Arrays in Java - Core Java

In This Question A value is 'everywhere' in an array if for every pair of adjacent elements in the array, at least one of the pair is that value. Return true if the given value is everywhere in the array. isEverywhere({1, 2, 1, 3}, 1) → true,coz 1 is present in(1,2) and (1,3) isEverywhere({1, 2,...
Deepak
5

votes
4

answer

Java calling C calling Java

I want to call a C funcion from Java using JNI. And in the C function, I want to create a JVM and call some Java objects. When I try to create the JVM, JNI_CreateJavaVM returns -1. So, I want to know if it is possible to do this. The C code is compiled to create a .so file (in linux), and the Java...
arnott
1

votes
1

answer

Java Applet: Java Version, update

I am making a Java Applet right now. I have compiled with Java 1.5. When I run my applet in Firefox it does not run. When I open the console in the browser (right click on the applet -> view console) it tells me that I am only running Java 1.4.2. In my browser. I am wondering is it safe to de...
sixtyfootersdude
1

votes
2

answer

Java EE/Java Browser Security

I have a problem with my Java EE (Tomcat) java based web application. user logs in to website user viewing page a ssl page in our web site user logs off, session invalidated user gets redirected to login page (ssl) user hits the back button and is able to get to the page in step 2. How is this av...
c12
2

votes
0

answer

Split [java-se] from [java]

Are we removing the Java tag from questions not explicitly about 'Java SE'? and Deleting java tag from questions tagged android+java and Delete Java tag from 100% Android related questions are all examples where there has been confusion with the java-tag regarding examples which were not about Java...
geisterfurz007
2

votes
4

answer

A riddle in java - Java

My friend gave me a riddle to solve. It goes like this: There are 100 people. Each one of them, in his turn, does the following: The first person opens all the boxes. The second person change the state to all the boxes whose number is divided by 2, without remainders. For instance, if a box is open...
David Lasry
1

votes
4

answer

Android-java vs PC-Java

This simple line of code gives the error 'The method getTextContent() is undefined for the type Element': String color_string = ( ( Element )( ( Element )inner_node ).getElementsByTagName( 'color' ).item( 0 ) ).getTextContent(); I get the error in my Android-java version, but not in my PC-Java which...
Espen
6

votes
3

answer

Java starting another Java Application

I am in the process of building a wrapper jar for a jar that I built. It will handle updating the main application and making sure users are valid users. I am having a major issue though, because I can't get the external jar launching function working. This is what I have so far: ProcessBuilder buil...
Aaron
5

votes
2

answer

AES Encryption Java -> PHP -> Java

In my Android app I am communicating with a web service the data sent and responded are encrypted with AES encryption. So what I do is the following. I'm sending a base64 encoded AES encrypted JSON String to share.php Share.php will then decrypt this string and insert it into the database. After tha...
sn0ep
0

votes
2

answer

java java.lang.outofmemoryerror: java heap space

Okay so im programming a game for my A-Level computing project, and so far everything has gone okay. I finished the framework, and started implementing gameplay when i got a java.lang.OutOfMemoryError: Java heap space (full error below). I've never experienced this before, however could it be to do...
Admin Hydra
4

votes
1

answer

Java BigDecimal.doubleValue between Java 6 and Java 8

Case 1: In Java6 BigDecimal('0.0050000').doubleValue() returns 0.0050, and in Java 8 return value is 0.005 Case 2: In Java6 BigDecimal('0.0250000').doubleValue() returns 0.025, and in Java 8 return value is 0.025 In case 1: Java 6 returns with extra trailing zero.. Any idea?? Also how to make Java...
arunodak
1

votes
1

answer

Java - Make src/main/java compile with java 1.4 and src/test/java compile with 1.5

I have a project which must be compiled only with java 1.4. But I am planning to write some unit tests using mockito. I want a way to specify in pom so that src/main/java compiles with jdk 1.4 but src/test/java compiles with jdk 1.5. Is there a way to do this? If yes, what pom changes should be made...
Rishi
1

votes
3

answer

Interpretation of Java-code in Java based application - how to run java code in java program

I want to use Java TM Scripting Engines, but not with JavaScript. I want to use ScriptEngine for Java language. I found Article where all explains. But I can't run example. Maven dependency java-engine. Java TM Scripting Engines - supports many different kinds of engines When I try to run program I...
452
2

votes
2

answer

calling java methods from java script

I am trying to create a light weight web interface using embedded jetty to host the server, and a simple html code with a java script to display the main page, since the pages are not static depending on a condition I would need to make a call to a java code. The sample html code is as follows : f...
bhavs
11

votes
1

answer

java/lang/NoClassDefFoundError: java/lang/Object [closed]

Am facing problem with java setting. My JAVA_HOME is C:\Program Files\Java\jdk1.7.0_09 PATH is C:\Program Files\Java\jdk1.7.0_09\bin . When I try run the command java -version, it is throwing an error : Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
user1490244
11

votes
1

answer

Java 8 performance VS. Java 7

I'm developing a imaging processing Java 7u80 application using C++ libraries through JNI. As I was willing to execute streams in parallel with Java 8u60, I just switched to JDK 8 and relaunched all my unit tests. Java 8u60 Overall duration: **35'408 [ms]** Java 7u80 Overall duration: **29'581 [ms]...
Hey StackExchange
1

votes
5

answer

Java developer moving into Java Desktop development

I've been writing Java web (JSF, Struts, JSR168) apps for a number of years. With the recent departure of a colleague, it looks like I'm going to be building more client applications. I've used Eclipse since the beginning and I'm really comfortable with it. It feels as though SWT is waning (just...
Jamie McIlroy
7

votes
6

answer

Execute Java code in Java [duplicate]

Possible Duplicate: Convert String to code in Java Dynamic code execution on Java I have a String containing : 'for(int i=0 ; i
Devashish Dixit
2

votes
0

answer

Java AST to .java file Rascal

I am wondering if there are mechanics in place to translate from a Java AST back to a Java source file inside the lang::java::m3 library. thanks!
josh
2

votes
4

answer

Java Properties File binding to Java Interface

With GWT you have stuff like this: public interface LoginConstants extends Constants { @DefaultStringValue('Wellcome to my super app') @Key('appDescription') String appDescription(); @DefaultStringValue('Ok') @Key('okButtonLabel') String okButtonLabel(); } Then you can use from your classes doing GW...
Luigi R. Viggiano
1

votes
3

answer

Java AOT + loading java classes dynamically

I'm building a plugin system for my application. I've read that anyone can decomple .class files and therefore I'm forced ot use a Ahead-Of-Time compiler (right?). The problem is that I need to load some plugin classes dynamically. Right now I'm loading all .class files in a folder and invoking a st...
Baversjo
3

votes
1

answer

Launch Java class from another Java application

Is there a way to launch a java class (and pass it a classpath and libary path) from within a Java application with out using Runtime.exec? I have seen: Launch a java application from another java application but need to be able to pass a CLASSPATH and libary path. I am trying to make a launcher tha...
WookooUK
19

votes
6

answer

Compile to java bytecode (without using Java)

My compilers class is creating a language that we intend to compile to Java Bytecode. We have made plenty of progress and are nearing the time where it's time for code generation. We are having problems locating information on how to create .class files from our compiler. Do you have any resources t...
Allyn
3

votes
1

answer

Java bytecode, java Supplier and invokedynamic argument

I have this class, and I compile it. package org.test; import java.util.function.Supplier; public class Test { static String get() { return '!!'; } public static void main(String[] args) { Supplier sup = Test::get; System.out.println(sup.get()); } } Then, trying to look into it's bytecode, I get fol...
Wyvie