Search java

173714 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
2

votes
2

answer

Java on Iphone / IPad - Java Simulator / Proxy?

I wish to have a java-chat on the iphone / ipad. With both, as far i know, it's not possible to have java there. But I see a lot of mysteriuos things in the internet the last years, so I must ask - is there any possibilty to run a java-chat on IPad / Iphone?!
Kovu
1

votes
5

answer

Convert Java Servlet to Standalone Java Application

I have a legacy Java servlet that is currently running in a Tomcat container. I want to run it outside the container, as a standalone Java application. The primary intention in doing so is because the new role in which this application will be deployed, involves only computation, and no servicing of...
2

votes
1

answer

Java and gstreamer-java initialisation error

I am building a small app which will play streaming audio from the internet in java (mainly internet radio stations). I have decided to use the gstreamer-java library for the sound, which uses JNA. I would like to include a check in the code, to see whether the gstreamer library has been initialised...
Mark
3

votes
1

answer

Java decompiler vs java disassembler [closed]

I am preparing core java and i got following doubt javap is dis-assembler or de-compiler? what is the difference between them? which java CLI commands are used ?
user3781572
4

votes
1

answer

Sending information from Java to Java script?

I've been trying to send information from Java to Java script using the JSObject but i keep receiving a java.lang.ClassNotFoundException: com.sun.deploy.appcontext.AppContext exception i'm using netbeans 7.1. Here is the full stack trace java.lang.NoClassDefFoundError: com/sun/deploy/appcontext/AppC...
JCS
2

votes
4

answer

Iterating Java Arrays in Java 8

So here's a simple algorithmic problem, Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Solve it without division and in O(n). For example, given [1,2,3,4], return [24,12,8,6]. Here's my so...
Melissa Stewart
2

votes
2

answer

Import Java project into Eclipse using Java

I've written a java program that writes another java project. However, I want to add a piece of specific code that will import the project into the workspace. Can this be done?
Ritwik Bose
4

votes
5

answer

Java Media API: java media api download

Where can i find javax.media.* jar file.. In sun site it downloads an installer. Is there any available of the media jar for java?
sri
26

votes
6

answer

Java Web Start vs Embedded Java Applet

I'm going to deploy my Java game to show it to my friends and whatnot, but I'm having trouble deciding between Java Web Start and applets. Under what conditions is one preferable over another and what advantages/disadvantages are there?
Matthew H
3

votes
3

answer

Java events vs C# - new to Java

I am new to the world of Java. I'm coming from C#. I'm trying to set up a custom event. Here is how I would have done this in C# class A { public EventHandler Changed; public void FunctionA() { if(Change != null) Changed(this, null); //fire the event! } } class B { private A instanceOfA = new A();...
26

votes
1

answer

ClassCast error: Java 7 vs Java 8

Is this a bug or feature? The following code runs fine in Java 7 but throws an exception in Java 8: The last command throws a ClassCast exception in Java8, all the 'equivalent' commands above work the same way. The problem, I think, is that in Java 8, the compiler decides to use String.value(char[]...
Jirka