Search Results

Search found 33640 results on 1346 pages for 'java generics'.

Page 127/1346 | < Previous Page | 123 124 125 126 127 128 129 130 131 132 133 134  | Next Page >

  • How to prepare for a Java test?

    - by Zenzen
    Ok so in two days I have a test for my dream job (well it's an internship, but still!) and for quite some time now I've been reading the SCJP Guide book in order to prepare myself. BUT seeing how slow my reading speed is I guess finding a website with some "java essentials" or "standard java test questions" and going through it in those 2 days would be a better idea. Don't misunderstand me, I do have java experience and it's "only" an internship, but we all know how programming tests look like and how tricky they can be. So are there any online resources you could recommend me? I know 2 days is not much, but well I was informed bout the test 1-2days ago.

    Read the article

  • How to import a WCF web service using a Java client

    - by JRP
    I have a WCF web service using wsHttpBinding that I am consuming from a Java client. I generated code from the WSDL using wsimport. The java client appears to be creating the service fine but when I call a method on the service the client just spins. MyService s = new MyService(); IMyService i = s.getWSHttpBindingIMyService(); returnedValue = i.getSomething(2); // method call Can a java client communicate with a WCF webservice that is using wsHttpBinding? I have read that I might need to use WSIT (Metro) but am confused on how to proceed with that. Any help will be appreciated.

    Read the article

  • Java RegEx Pattern not matching (works in .NET)

    - by CDSO1
    Below is an example that is producing an exception in Java (and not matching the input). Perhaps I misunderstood the JavaDoc, but it looks like it should work. Using the same pattern and input in C# will produce a match. import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] args) { String pattern = "aspx\\?uid=([^']*)"; Pattern p = Pattern.compile(pattern); Matcher m = p.matcher("id='page.aspx?uid=123'"); System.out.println(m.groupCount() > 0 ? m.group(1) : "No Matches"); } }

    Read the article

  • Working with a Java Mail Server for Testing

    - by Charlie
    I'm in the process of testing an application that takes mail out of a mailbox, performs some action based on the content of that mail, and then sends a response mail depending on the result of the action. I'm looking for a way to write tests for this application. Ideally, I'd like for these tests to bring up their own mail server, push my test emails to a folder on this mail server, and have my application scrape the mail out of the mail server that my test started. Configuring the application to use the mailserver is not difficult, but I do not know where to look for a programatic way of starting a mail server in Java. I've looked at JAMES, but I am unable to figure out how to start the server from within my test. So the question is this: What can I use for a mail server in Java that I can configure and start entirely within Java?

    Read the article

  • How do I override Currency symbols in Java?

    - by edgydruid
    I'm trying to print prices in Turkish Liras (ISO 4217 currency code TRY) with Java. When I do Currency curr = Currency.getInstance("TRY"); Locale trLocale = new Locale("tr", "TR"); System.out.println(curr.getSymbol(trLocale)); the output is: "YTL". However, the currency symbol for Turkish Lira has recently changed from "YTL" to "TL" (as can be seen on the Wikipedia page for Turkish Lira). Formatting with NumberFormat gives a similar result. I really don't want to write yet another Currency class, especially when Java has one built-in. Is there a way to override Java's default currency symbol for TRY to "TL"?

    Read the article

  • java share data between thread

    - by ayush
    i have a java process that reads data from a socket server. Thus i have a BufferedReader and a PrintWriter object corresponding to that socket. Now in the same java process i have a multithreaded java server that accepts client connections. I want to achieve a functionality where all these clients that i accept can read data from the BufferedReader object that i mentioned above.(so that they can multiplex the data) How do i make these individual client threads read the data from BuffereReader single object? Sorry for the confusion.

    Read the article

  • Java + MS Exchange: how to retrieve .msg files

    - by Cesar
    Dear people, I've created a Java program with which I can retrieve mail from an Exchange mailserver. Problem is: the mail is in EML format and I need the MSG format! Right now I'm retrieving mail through the web access part of Exchange, using the Apache Slide project... is it possible at all to use java to retrieve msg files from an Exchange server? I've seen examples of C# code, .NET code etc.. isn't it possible somehow to integrate these pieces of code with Java so I can use it to retrieve mail? Greets, Cesar

    Read the article

  • How to add system property equivalent to java -D in Ant

    - by Shervin
    Hi. I need to set java -Djava.library.path=/some/path and I want to do it when I am running my ant script, building my jar. I think I have to use <sysproperty key="java.library.path" value="/some/path"/> but it doesnt work. I cannot make the syntax work. The only thing I have Googled and found is sysproperty in conjunction with <java classname> but that doesnt make any sense to me. I am not sure if this is relevant, but I am using ant to create a ear and deploying this ear in JBoss.

    Read the article

  • java reading numbers, interpreting as octal, want interpreted as string

    - by user331401
    hello, i am having an issue, where java is reading an array list from a YAML file of numbers, or strings, and it is interpreting the numbers as octal if it has a leading 0, and no 8-9 digit. is there a way to force java to read the yaml field as a string? code: ArrayList recordrarray = (ArrayList) sect.get("recordnum"); if (recordrarray != null) { recno = join (recordrarray, " "); } HAVE ALSO TRIED: Iterator<String> iter = recordrarray.iterator(); if (iter.hasNext()) recno = " " +String.valueOf(iter.next()); System.out.println(" this recnum:" + recno); while (iter.hasNext()){ recno += ""+String.valueOf(iter.next())); System.out.println(" done recnum:" + String.valueOf(iter.next())); } the input is such: 061456 changes to 25390 061506 changes to 25414 061559 - FINE it took a while to figure out what it was doing, and apparently this is a common issue for java, ideas? thanks

    Read the article

  • java equivalent of ruby's ||= syntax

    - by brad
    I'm brand new to java, coming from a ruby world. One thing I love about ruby is the very terse syntax such as ||=. I realize of course that a compiled language is different, but I'm wondering if Java has anything similar. In particular, what I do all the time in ruby is something like: someVar ||= SomeClass.new I think this is incredibly terse, yet powerful, but thus far the only method I can think of to achieve the same thing is a very verbose: if(someVar == null){ someVar = new SomeClass() } Just trying to improve my Java-fu and syntax is certainly one area that I'm no pro.

    Read the article

  • Prim's MST algorithm implementation with Java

    - by user1290164
    I'm trying to write a program that'll find the MST of a given undirected weighted graph with Kruskal's and Prim's algorithms. I've successfully implemented Kruskal's algorithm in the program, but I'm having trouble with Prim's. To be more precise, I can't figure out how to actually build the Prim function so that it'll iterate through all the vertices in the graph. I'm getting some IndexOutOfBoundsException errors during program execution. I'm not sure how much information is needed for others to get the idea of what I have done so far, but hopefully there won't be too much useless information. This is what I have so far: I have a Graph, Edge and a Vertex class. Vertex class mostly just an information storage that contains the name (number) of the vertex. Edge class can create a new Edge that has gets parameters (Vertex start, Vertex end, int edgeWeight). The class has methods to return the usual info like start vertex, end vertex and the weight. Graph class reads data from a text file and adds new Edges to an ArrayList. The text file also tells us how many vertecis the graph has, and that gets stored too. In the Graph class, I have a Prim() -method that's supposed to calculate the MST: public ArrayList<Edge> Prim(Graph G) { ArrayList<Edge> edges = G.graph; // Copies the ArrayList with all edges in it. ArrayList<Edge> MST = new ArrayList<Edge>(); Random rnd = new Random(); Vertex startingVertex = edges.get(rnd.nextInt(G.returnVertexCount())).returnStartingVertex(); // This is just to randomize the starting vertex. // This is supposed to be the main loop to find the MST, but this is probably horribly wrong.. while (MST.size() < returnVertexCount()) { Edge e = findClosestNeighbour(startingVertex); MST.add(e); visited.add(e.returnStartingVertex()); visited.add(e.returnEndingVertex()); edges.remove(e); } return MST; } The method findClosesNeighbour() looks like this: public Edge findClosestNeighbour(Vertex v) { ArrayList<Edge> neighbours = new ArrayList<Edge>(); ArrayList<Edge> edges = graph; for (int i = 0; i < edges.size() -1; ++i) { if (edges.get(i).endPoint() == s.returnVertexID() && !visited(edges.get(i).returnEndingVertex())) { neighbours.add(edges.get(i)); } } return neighbours.get(0); // This is the minimum weight edge in the list. } ArrayList<Vertex> visited and ArrayList<Edges> graph get constructed when creating a new graph. Visited() -method is simply a boolean check to see if ArrayList visited contains the Vertex we're thinking about moving to. I tested the findClosestNeighbour() independantly and it seemed to be working but if someone finds something wrong with it then that feedback is welcome also. Mainly though as I mentioned my problem is with actually building the main loop in the Prim() -method, and if there's any additional info needed I'm happy to provide it. Thank you. Edit: To clarify what my train of thought with the Prim() method is. What I want to do is first randomize the starting point in the graph. After that, I will find the closest neighbor to that starting point. Then we'll add the edge connecting those two points to the MST, and also add the vertices to the visited list for checking later, so that we won't form any loops in the graph. Here's the error that gets thrown: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(Unknown Source) at java.util.ArrayList.get(Unknown Source) at Graph.findClosestNeighbour(graph.java:203) at Graph.Prim(graph.java:179) at MST.main(MST.java:49) Line 203: return neighbour.get(0); in findClosestNeighbour() Line 179: Edge e = findClosestNeighbour(startingVertex); in Prim()

    Read the article

  • Java Web Service Client from Microsoft Live Search

    - by trendyy
    I generated java web service from here -- http://api.search.live.net/search.wsdl.. I want to make search and listing the return values. In my opinion i generated client and client is makes research but i can't display result, how i can do that.. Can anyone check my wrote code and help me about displaying result? Thanks... import java.rmi.RemoteException; import com.microsoft.schemas.LiveSearch._2008._03.Search.*; public class searchtry { public static void main(String[] args) throws RemoteException { LiveSearchPortTypeProxy client=new LiveSearchPortTypeProxy(); SearchRequest request=new SearchRequest(); SearchRequestType1 type1=new SearchRequestType1(); sorgu.setAppId("*********************************"); //Windows Live gave this id for using that service sorgu.setSources(new SourceType[]{SourceType.Web}); sorgu.setQuery("Java"); aratip.setParameters(request); SearchResponseType0 answer= client.search(type1); System.out.println(answer.toString()); }

    Read the article

  • GlassFish Starting Up Java SE Client - No Initial Context Exception

    - by Marcel
    Hi I have developed a java se client that calls some session beans on a glassfish server. I connect to the bean remote interface like this. context = new InitialContext(); em = (ICrudService) context.lookup("java:global/BackITServer/CrudServiceImpl"); This works fine from inside eclipse (gf-client on build path). When I export my project as a runnable jar and call it on the console with java -jar BackItClient.jar I get a NoInitialContextException. MMMM. I would very much appreciate some help. Thank You Greetings Marcel PS: Do I really have to pack all the jars which gf-client is referencing into my jar?

    Read the article

  • Is it required to generate java classes to use spring-ws client

    - by vishnu
    Hi, I want to use spring ws to create the webservice client. I have seen some documentation. In all using jaxb marshalling and unmarshalling. But to start of need to create java classes from xsd. I tried to download the elcipse plugin for this. The location in java.net is not showing any thing to download. Sourceforce net showing the link to download. But that plugin is not working. I have tried wsimport, but it is generating only .classes? My question is if i want to use spring ws, is it required to generate .java classes? If so where can i find the elipse plugin or how to generate the classes? Is there any other way we can do without generating these classes?

    Read the article

  • java web development, what skills do I need?

    - by mrblah
    I want to learn, at least at a basic level, how to build java web applications (coming from a .net background). Meaning, I would like to be able to build, deploy a simple cms type application from the ground up. What exactly do I need to learn? Tomcat seems to be a good web server for Java. What options are there for the web? I know there is hibernate for an ORM. Does java have MVC? what about JSP? can MVC and JSP be together? beans? Maybe a book that covers all of these?

    Read the article

  • [Java] - Problem having my main thread sleeping

    - by Chris
    I'm in a Java class and our assignment is to let us explore threads in Java. So far so good except for this one this one problem. And I believe that could be because of my lack of understanding how Java threads work at the moment. I have the main thread of execution which spawns new threads. In the main thread of execution in main() I am calling Thread.sleep(). When I do I get an Unhandled exception type InterruptedException. I am unsure of why I am getting this? I thought this was because I needed a reference to the main thread so I went ahead and made a reference to it via Thread.currentThread(). Is this not the way to have the thread sleep? What I need to do is have the main thread wait/sleep/delay till it does it required work again. Any help would be much appreciated.

    Read the article

  • GWT Date Picker Format problem when saving a java date through hibernate in postgresql

    - by Noor
    Hi, I am using Java Date and Hibernate which is then being saved in the database (Postgresql). I am not that good in hibernate Part of the Mapping File <property name="DateOfBirth" type="java.util.Date"> <column name="DATEOFBIRTH" /> </property> I am using GWT Date picker Short date format i.e. yyyy-MM-dd. I am getting the value from the date picker using View.getUserDateOfBirth().getValue() But when I am saving the date 2010-11-30 into the datebase it is saving it as 2010-11-30 00:00:00 instead of 2010-11-30 So, I want it to be saved in the database as in this format 2010-11-30?? I have many things such timestamp but i not being able to configure it. I think this part <property name="DateOfBirth" type="java.util.Date"> <column name="DATEOFBIRTH" /> </property> should be changed but I do not know what to change

    Read the article

  • Java is open-source, so what?

    - by typoknig
    Hi all, I always here that Java being open-source is a big benefit, but I fail to see how Java being open-source should draw me to use it as opposed to .NET which is closed-source. This website has some Q&A sections (What is the significance of these developments to the industry? in particular) that give a little info, but is being free the only (or the biggest) advantage to Java being open-source? Since I am a beginner, have any of you pros noticed any major difference since the change was made?

    Read the article

  • How to build a distributable jar with Ant for a java project having external jar dependencies

    - by Nikunj Chauhan
    I have a Java project in Eclipse with class MainClass having main method in package : com.nik.mypackage. The project also references two external libraries, which I copied in the lib folder in Eclipse and then added to build path using ADD JAR function. The libraries being one.jar and two.jar This library is in lib folder in eclipse and added to the build path. I want to create a executable JAR of the application using ant script. So that user can access my application using command: c:>java -jar MyProject-20111126.jar I know about the Eclipse plugin which directly exports a java application as runnable JAR. But I want to learn ant and the build process so manually want to create the build.xm.

    Read the article

  • String of KML needs to be converted to java objects

    - by spartikus
    I have a string of kml coming in on a request object. I have used xjc to create the kml java objects. I am looking for an easy way to create the kml nested java objects from this string. I could parse the string and create each object in the tree by hand but wouldn't it be cool if there was a library or something that would create the java objects for me? Something like KmlType type = parseKML(mykmlStringFromTheRequest); Then type would be a Tree of kml objects. Thanks for the help all.

    Read the article

  • How to handle packages provided Java using Eclipse P2

    - by ctron
    I got some OSGi bundles in binary form that declare dependencies to bundles like "org.ietf.jgss" which are provided by Java itself. P2 detects these dependencies and when I try to install the product later using the P2 director application the installation fails since no bundle provides these packages. But if I use the P2 product build I get a complete installed product that I can use. My problem is that I don't want to create product files and build for each variation of the application. So tried the approach to copy all P2 repositories in order to install the product on the target system using the P2 director. So how do I handle dependencies to packages provided by Java and how to I "convince" P2 to ignore these packages if they are provided by Java itself. Thanks for helping.

    Read the article

  • What's the best Java-based forum software?

    - by SamS
    Somebody asked about .NET-based forum software here: http://stackoverflow.com/questions/11046/forum-software-recommandations-net Now I have a similar question but I prefer Java. I'm interested in building a community site so I'd like to know my options. It doesn't have to be free but it needs to be something a normal engineer can afford. Thanks! Update: I prefer a Java-based solution because I'm a Java developer and I figure that it would be easier for me to customize it or modify its code when necessary. I know that PHP forums such as phpBB and vBulletin are very popular but I wouldn't want to touch PHP code.

    Read the article

  • Difference between C++ Keyboard keycode and JAVA KeyEvent keycode

    - by Auxiliary
    I noticed a difference between the keycodes that vkCode in C++ gives and the ones that Java's KeyEvent gives us. (Ofcourse the normal characters have the same code (0 = 48 just like the ASCII) but they differ in the other keys). Is there a way to 'translate' them from one to the other (What's the logic behind each one?) or am I supposed to use loads of switches and IFs for that. If it helps, my app is half in C++ and half in JAVA because of the Native Hooks that c++ gives us and it gets the keycodes of the keys that the user presses and then the java is going to use them. Thanks in advance.

    Read the article

  • What is a good Java web crawler library?

    - by DrDee
    Hi, I am about to develop a crawler in Java but don't feel like reinventing the wheel. A quick Google search gives a whole bunch of Java libraries to build a web crawler. Besides that Nutch is of course a very robust package but seems a bit too advanced for my needs. I only need to crawl a handful websites a week containing a couple of 1000 pages each. Which open source Java library would you recommend considering: speed multithreading (or even distributed) extending it with new functionality active maintained and documentation?

    Read the article

  • SSL connection using Java standalone app

    - by Marquinio
    I have created a standalone executable JAR program that needs to send private information over a SSL connection. I was not able to establish the SSL connection using certificates. Was getting this: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path `building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target` So I found some code somewhere that creates a trust manager that does not validate certificate chains: // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType) { } } }; That did the trick and I was able to establish SSL connection without any certificates. My concern is if the data will still be encrypted when exchanging private information. This is an execute JAR file that clients will be downloading to their computers. So is a certificate really necessary for this case? Thanks.

    Read the article

< Previous Page | 123 124 125 126 127 128 129 130 131 132 133 134  | Next Page >