Java 1.8.0-ea-b47 + Lambdas?

class Main {
     interface Squarer<X, Y> {
          Y square(X x);
public static void main(String[] args) {
          final Squarer<Integer, Integer> s = (x) -> x * x;
System.out.println("Hello World!");
With version: Java(TM) SE Runtime Environment (build 1.8.0-ea-b47)
javac -source 8 Main.java
Main.java:7: error: lambda expressions are not supported in -source 1.8
Is this feature just not ready for preview?

Refer similar post.
https://community.oracle.com/thread/3634249

Similar Messages

  • A java List that implements the Stream interface?

    Hello,
    I just took some time to start looking into the java-8 buzz about streams and lambdas.
    And have a couple of questions...
    The first thing that surprised me is that you cannot apply the streams operations,
    like .map(), .filter() directly on a java.util.List.
    First question:
    Is there a technical reason why the java.util.List interface was not extended with
    default-implementations of these streams operations? (I guess there is...?)
    Googling a bit, I see lots of examples of people coding along the pattern of:
        List<String> list = someExpression;
        List<String> anotherList = list.stream().map(x -> f(x)).collect(Collectors.toList());
    which becomes very clumsy, if you have a lot of these stream-operations in your code.
    Since .stream() and .collect() are completely irrelevant to what you want to express,
    you would rather like to say:
        List<String> list = someExpression;
        List<String> anotherList = list.map(x -> f(x));
    What I first did as a workaround, was to implement (see code below)
    a utility interface FList, and a utility class FArrayList (extending ArrayList with .map() and .filter()).
    (The "F" prefixes stand for "functional")
    Using these utilities, you now have two options to create less clumsy code:
        List<String> list = someExpression;
        List<String> anotherList = FList.map(list, x -> f(x));
        List<String> thirdList = FList.filter(list, somePredicate);
    or better:
        FList<String> list = new FArrayList<String>(someExpression);
        FList<String> anotherList = list.map(x -> someFunction(x));
        FList<String> thirdList = list.filter(somePredicate);
    My second question:
    What I would really like to do is to have FArrayList implement the
      java.util.stream.Stream interface, to fully support the java-8 functional model.
    Since that involves implementing some 40 different methods, I would just like to know,
    if you know somebody has already done this kind of work, and the code is
    available somewhere as a public jar-file or open-source?
        public interface FList<T> extends List<T> {
            public static <A, B> List<B> map(List<A> list, Function<A, B> f) {
                return list.stream().map(f).collect(Collectors.toList());
            public static <A> List<A> filter(List<A> list, Predicate<A> f) {
                return list.stream().filter(f).collect(Collectors.toList());
            default <R> FList<R> map(Function<T, R> f) {
                FList<R> result = new FArrayList<R>();
                for (T item : this) {
                    result.add(f.apply(item));
                return result;
            default FList<T> filter(Predicate<T> p) {
                FList<T> result = new FArrayList<T>();
                for (T item : this) {
                    if (p.test(item)) {
                        result.add(item);
                return result;
        public class FArrayList<T> extends ArrayList<T> implements List<T>, FList<T> {
            private static final long serialVersionUID = 1L;
            public FArrayList() {
                super();
            public FArrayList(List<T> list) {
                super();
                this.addAll(list);

    I believe SSH and telnet are used for interactive command line sessions, don't know how you want to use them in a program.

  • Heap error in Sequence

    Hi
    i am reading data from a URL using XML
    i iterate on the XML and storing ina Sequence. i am gettign heap error.
    // data i get is 50
    var playerList:String[]=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""];
    var rankList:Number[]=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
    def pullParser = PullParser {
            documentType: PullParser.XML;
            onEvent: function (event : Event) : Void {
            if (event.type == PullParser.START_ELEMENT) {
          var attVal : String = event.getAttributeValue(QName {name : "userid"});
          playerList[iPlayer]= "{attVal}";
          iPlayer++;
         FX.println(attVal);
            } else if (event.type == PullParser.END_ELEMENT) {
             var textVal : String = event.text;
              rankList[iRank]=Integer.parseInt("{textVal}");
             iRank++;
             FX.println(textVal);
    data: [
                BarChart.Series {
                    name: "2008"
                    data: [
                        for(val in rankList)
                            FX.println("Data Inserting : {val}");
                        BarChart.Data {
                           // value: Integer.parseInt("{val}")
                           value: val
    ......Above code is givign heap error. please help.

    i am trying to insert string/object to var playerList:String[]=[]; but..
    i am getting following error
    Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
    at com.sun.javafx.runtime.location.AbstractLocation.addDependency(AbstractLocation.java:316)
    at com.sun.javafx.runtime.location.AbstractLocation.addDependency(AbstractLocation.java:310)
    at com.sun.javafx.runtime.location.Locations.makeIndirectHelper(Locations.java:173)
    at com.sun.javafx.runtime.location.Locations.makeBoundSelect(Locations.java:150)
    at com.sun.javafx.scene.control.caspian.LabelSkin.computeDisplayedTitle$$bound$(LabelSkin.fx:258)
    at com.sun.javafx.scene.control.caspian.LabelSkin.userInit$(LabelSkin.fx:126)
    at com.sun.javafx.runtime.FXBase.complete$(FXBase.java:56)
    at com.sun.javafx.scene.control.caspian.LabelSkin.initialize$(LabelSkin.fx:39)
    at com.sun.javafx.scene.control.caspian.LabelSkin.<init>(LabelSkin.fx:39)
    at com.sun.javafx.scene.control.caspian.CaspianTheme.createLabelSkin(CaspianTheme.fx:49)
    at javafx.scene.control.Label.createDefaultSkin(Label.fx:74)
    at javafx.scene.control.Control.create(Control.fx:165)
    at javafx.scene.CustomNode.userInit$(CustomNode.fx:129)
    at javafx.scene.control.Control.userInit$(Control.fx:54)
    at javafx.scene.control.Label.userInit$(Label.fx:37)
    at com.sun.javafx.runtime.FXBase.complete$(FXBase.java:56)
    at javafx.scene.chart.part.Axis$TickMark.applyDefaults$(Axis.fx:364)
    at javafx.scene.chart.part.CategoryAxis.updateTickMarks(CategoryAxis.fx:96)
    at javafx.scene.chart.part.CategoryAxis$_SBECL.onChange(CategoryAxis.fx:51)
    at com.sun.javafx.runtime.location.SequenceVariable.notifyListeners(SequenceVariable.java:157)
    at com.sun.javafx.runtime.location.SequenceVariable$BoundLocationInfo$2.onChange(SequenceVariable.java:940)
    at com.sun.javafx.runtime.location.SequenceVariable.notifyListeners(SequenceVariable.java:157)
    at com.sun.javafx.runtime.location.SequenceVariable.replaceSlice(SequenceVariable.java:324)
    at com.sun.javafx.runtime.location.SequenceVariable.insert(SequenceVariable.java:442)
    at arimaagraph.WorldRatingGraph$1.lambda(WorldRatingGraph.fx:49)
    at arimaagraph.WorldRatingGraph$1.invoke(WorldRatingGraph.fx:45)
    at arimaagraph.WorldRatingGraph$1.invoke(WorldRatingGraph.fx:45)
    at javafx.data.pull.PullParser.setEvent(PullParser.fx:547)
    at javafx.data.pull.PullParser.next(PullParser.fx:334)
    at javafx.data.pull.PullParser.parse(PullParser.fx:258)
    at arimaagraph.WorldRatingGraph$2.lambda(WorldRatingGraph.fx:74)
    at arimaagraph.WorldRatingGraph$2.invoke(WorldRatingGraph.fx:70)
    When progressing 46th sequence.

  • How does JavaFX connect to Web Servers?

    Recently,I was learing about JavaFX and confused with the way that
    1.how does JavaFX connection to Web Servers?
    2.Is there anything related to SOAP protocol?
    Please help me.Thanks.

    I don't understand very well...
    in the Web service style, is this Java code ? or JavaFX code
    How can I use JavaFX to call a web service (not REST, just pure web service)
    I did it by this article
    http://netbeans.dzone.com/news/javafx-client-invoking-metro-e
    But i have two problem.
    1. when deploy as applet, there is security issue, how can i resolve ?
    2. my application invoke easy web service is ok, but when invoke some complex type web service, there is error like this...
    Exception in thread "AWT-EventQueue-0" java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:653)
    at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:460)
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:286)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
    at java.lang.Class.initAnnotationsIfNecessary(Class.java:3072)
    at java.lang.Class.getAnnotation(Class.java:3029)
    at com.sun.xml.ws.model.RuntimeModeler$1.run(RuntimeModeler.java:183)
    at com.sun.xml.ws.model.RuntimeModeler$1.run(RuntimeModeler.java:182)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.xml.ws.model.RuntimeModeler.getPrivClassAnnotation(RuntimeModeler.java:181)
    at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:217)
    at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:683)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:340)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:323)
    at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:305)
    at javax.xml.ws.Service.getPort(Service.java:92)
    at allan.EasyWSService.getEasyWSSoapPort(EasyWSService.java:56)
    at javacode.Test.go(Test.java:11)
    at conferenceclient.Main$1.lambda(Main.fx:36)
    at conferenceclient.Main$1.lambda(Main.fx:36)
    at conferenceclient.Main$1.invoke(Main.fx:31)
    at conferenceclient.Main$1.invoke(Main.fx:31)
    at conferenceclient.Main$1.invoke(Main.fx:31)
    at conferenceclient.Main$1.invoke(Main.fx:31)
    at javafx.ext.swing.SwingAbstractButton$1ActionListener$anon13.actionPerformed(SwingAbstractButton.fx:150)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6134)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
    at java.awt.Component.processEvent(Component.java:5899)
    at java.awt.Container.processEvent(Container.java:2023)
    at java.awt.Component.dispatchEventImpl(Component.java:4501)
    at java.awt.Container.dispatchEventImpl(Container.java:2081)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
    at java.awt.Container.dispatchEventImpl(Container.java:2067)
    at java.awt.Window.dispatchEventImpl(Window.java:2458)
    at java.awt.Component.dispatchEvent(Component.java:4331)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

  • Anonymous Functions (Lambda expressions) in Java?

    Hello,
    I need to know if there are anonymous functions in Java. I am writing a platform independent shell, and I would like to use anonymous functions to make the shell better.
    Does Java support anonymous functions or is it unsupported?
    Thanks.

    functions without a name? no
    functions belong to classes, and every class method has a name.
    you want to use lisp.
    %

  • How can I use XStream to persist complicated Java Object  to XML & backward

    Dear Sir:
    I met a problem as demo in my code below when i use XTream to persist my Java Object;
    How can I use XStream to persist complicated Java Object to XML & backward??
    See
    [1] main code
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.ArrayList;
    import com.thoughtworks.xstream.XStream;
    import com.thoughtworks.xstream.io.xml.DomDriver;
    public class PhoneList {
         ArrayList<PhoneNumber> phones;
         ArrayList<Person> person;
         private PhoneList myphonelist ;
         private LocationTest location;
         private PhoneList(String name) {
         phones = new ArrayList<PhoneNumber>();
         person = new ArrayList<Person>();
         public ArrayList<PhoneNumber> getphones() {
              return phones;
         public ArrayList<Person> getperson() {
              return person;
         public void addPhoneNumber(PhoneNumber b1) {
              this.phones.add(b1);
         public void removePhoneNumber(PhoneNumber b1) {
              this.phones.remove(b1);
         public void addPerson(Person p1) {
              this.person.add(p1);
         public void removePerson(Person p1) {
              this.person.remove(p1);
         public void BuildList(){
              location = new LocationTest();
              XStream xstream = new XStream();
              myphonelist = new PhoneList("PhoneList");
              Person joe = new Person("Joe, Wallace");
              joe.setPhone(new PhoneNumber(123, "1234-456"));
              joe.setFax(new PhoneNumber(123, "9999-999"));
              Person geo= new Person("George Nixson");
              geo.setPhone(new PhoneNumber(925, "228-9999"));
              geo.getPhone().setLocationTest(location);          
              myphonelist.addPerson(joe);
              myphonelist.addPerson(geo);
         public PhoneList(){
              XStream xstream = new XStream();
              BuildList();
              saveStringToFile("C:\\temp\\test\\PhoneList.xml",convertToXML(myphonelist));
         public void saveStringToFile(String fileName, String saveString) {
              BufferedWriter bw = null;
              try {
                   bw = new BufferedWriter(
                             new FileWriter(fileName));
                   try {
                        bw.write(saveString);
                   finally {
                        bw.close();
              catch (IOException ex) {
                   ex.printStackTrace();
              //return saved;
         public String getStringFromFile(String fileName) {
              BufferedReader br = null;
              StringBuilder sb = new StringBuilder();
              try {
                   br = new BufferedReader(
                             new FileReader(fileName));
                   try {
                        String s;
                        while ((s = br.readLine()) != null) {
                             // add linefeed (\n) back since stripped by readline()
                             sb.append(s + "\n");
                   finally {
                        br.close();
              catch (Exception ex) {
                   ex.printStackTrace();
              return sb.toString();
         public  String convertToXML(PhoneList phonelist) {
              XStream xstream = new  XStream(new DomDriver());
              xstream.setMode(xstream.ID_REFERENCES) ;
              return xstream.toXML(phonelist);
         public static void main(String[] args) {
              new PhoneList();
    }[2].
    import java.io.Serializable;
    import javax.swing.JFrame;
    public class PhoneNumber implements Serializable{
           private      String      phone;
           private      String      fax;
           private      int      code;
           private      String      number;
           private      String      address;
           private      String      school;
           private      LocationTest      location;
           public PhoneNumber(int i, String str) {
                setCode(i);
                setNumber(str);
                address = "4256, Washington DC, USA";
                school = "Washington State University";
         public Object getPerson() {
              return null;
         public void setPhone(String phone) {
              this.phone = phone;
         public String getPhone() {
              return phone;
         public void setFax(String fax) {
              this.fax = fax;
         public String getFax() {
              return fax;
         public void setCode(int code) {
              this.code = code;
         public int getCode() {
              return code;
         public void setNumber(String number) {
              this.number = number;
         public String getNumber() {
              return number;
         public void setLocationTest(LocationTest bd) {
              this.location = bd;
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(location);
            f.getContentPane().add(location.getControls(), "Last");
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
         public LocationTest getLocationTest() {
              return location;
         }[3].
    package test.temp;
    import java.io.Serializable;
    public class Person implements Serializable{
         private String           fullname;
           @SuppressWarnings("unused")
         private PhoneNumber      phone;
           @SuppressWarnings("unused")
         private PhoneNumber      fax;
         public Person(){
         public Person(String fname){
                fullname=fname;           
         public void setPhone(PhoneNumber phoneNumber) {
              phone = phoneNumber;
         public void setFax(PhoneNumber phoneNumber) {
              fax = phoneNumber;
         public PhoneNumber getPhone() {
              return phone ;
         public PhoneNumber getFax() {
              return fax;
        public String getName() {
            return fullname ;
        public void setName(String name) {
            this.fullname      = name;
        public String toString() {
            return getName();
    }[4]. LocationTest.java
    package test.temp;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class LocationTest extends JPanel implements ChangeListener
        Ellipse2D.Double ball;
        Line2D.Double    line;
        JSlider          translate;
        double           lastTheta = 0;
        public void stateChanged(ChangeEvent e)
            JSlider slider = (JSlider)e.getSource();
            String name = slider.getName();
            int value = slider.getValue();
            if(name.equals("rotation"))
                tilt(Math.toRadians(value));
            else if(name.equals("translate"))
                moveBall(value);
            repaint();
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            if(ball == null)
                initGeom();
            g2.setPaint(Color.green.darker());
            g2.draw(line);
            g2.setPaint(Color.red);
            g2.fill(ball);
        private void initGeom()
            int w = getWidth();
            int h = getHeight();
            int DIA = 30;
            int padFromEnd = 5;
            line = new Line2D.Double(w/4, h*15/16, w*3/4, h*15/16);
            double x = line.x2 - padFromEnd - DIA;
            double y = line.y2 - DIA;
            ball = new Ellipse2D.Double(x, y, DIA, DIA);
            // update translate slider values
            int max = (int)line.getP1().distance(line.getP2());
            translate.setMaximum(max);
            translate.setValue(max-padFromEnd);
        private void tilt(double theta)
            // rotate line from left end
            Point2D pivot = line.getP1();
            double lineLength = pivot.distance(line.getP2());
            Point2D.Double p2 = new Point2D.Double();
            p2.x = pivot.getX() + lineLength*Math.cos(theta);
            p2.y = pivot.getY() + lineLength*Math.sin(theta);
            line.setLine(pivot, p2);
            // find angle from pivot to ball center relative to line
            // ie, ball center -> pivot -> line end
            double cx = ball.getCenterX();
            double cy = ball.getCenterY();
            double pivotToCenter = pivot.distance(cx, cy);
            // angle of ball to horizon
            double dy = cy - pivot.getY();
            double dx = cx - pivot.getX();
            // relative angle phi = ball_to_horizon - last line_to_horizon
            double phi = Math.atan2(dy, dx) - lastTheta;
            // rotate ball from pivot
            double x = pivot.getX() + pivotToCenter*Math.cos(theta+phi);
            double y = pivot.getY() + pivotToCenter*Math.sin(theta+phi);
            ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
            lastTheta = theta;  // save theta for next time
        private void moveBall(int distance)
            Point2D pivot = line.getP1();
            // ball touches line at distance from pivot
            double contactX = pivot.getX() + distance*Math.cos(lastTheta);
            double contactY = pivot.getY() + distance*Math.sin(lastTheta);
            // find new center location of ball
            // angle lambda = lastTheta - 90 degrees (anti-clockwise)
            double lambda = lastTheta - Math.PI/2;
            double x = contactX + (ball.width/2)*Math.cos(lambda);
            double y = contactY + (ball.height/2)*Math.sin(lambda);
            ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
        JPanel getControls()
            JSlider rotate = getSlider("rotation angle", "rotation", -90, 0, 0, 5, 15);
            translate = getSlider("distance from end",  "translate", 0, 100, 100,25, 50);
            JPanel panel = new JPanel(new GridLayout(0,1));
            panel.add(rotate);
            panel.add(translate);
            return panel;
        private JSlider getSlider(String title, String name, int min, int max,
                                  int value, int minorSpace, int majorSpace)
            JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, value);
            slider.setBorder(BorderFactory.createTitledBorder(title));
            slider.setName(name);
            slider.setPaintTicks(true);
            slider.setMinorTickSpacing(minorSpace);
            slider.setMajorTickSpacing(majorSpace);
            slider.setPaintLabels(true);
            slider.addChangeListener(this);
            return slider;
    }OK, My questions are:
    [1]. what I generated XML by XSTream is very complicated, especially for object LocationTest, Can we make it as simple as others such as Person object??
    [2]. after I run it, LocationTest will popup and a red ball in a panel will dsiplay, after I change red ball's position, I hope to persist it to xml, then when I read it back, I hope to get same picture, ie, red ball stiil in old position, How to do that??
    Thanks a lot!!

    Positive feedback? Then please take this in a positive way: if you want to work on persisting Java objects into XML, then GUI programming is irrelevant to that goal. The 1,000 lines of code you posted there appeared to me to have a whole lot of GUI code in it. You should produce a smaller (much smaller) example of what you want to do. Calling the working code from your GUI program should come later.

  • Uncaught exception: java.lang.Error: 137 in JavaFX

    Hi
    I am getting the error mentioned in subject while trying to Run a JavaFX application "Run in Mobile Emulator" mode. I am trying to use split() to separate concatenated String. The code snippet is given below :
    *onMouseClicked: function(e : MouseEvent) : Void {*       
    println("Inside on Mouse Clicked...");
    var sample = "Sherlyn|masrrev|Other";
    var names = sample.split("\\|");
    *println("{names.toString()}");*
    The error that I get is pasted below:
    *Inside on Mouse Clicked...*
    *Uncaught exception: java.lang.Error: 137*
    *- testsplit.Main$2.lambda(), bci=43*
    *- testsplit.Main$2.invoke(), bci=2*
    *- testsplit.Main$2.invoke(), bci=5*
    *- javafx.scene.Node.mouseClicked$impl(), bci=68*
    *- javafx.scene.Node.mouseClicked(), bci=3*
    *- com.sun.fxme.runtime.FXNodeDelegate$4.run(), bci=6*
    *- com.sun.fxme.runtime.RunnableQueue$Manager.run(), bci=86*
    *- com.sun.fxme.runtime.RunnableQueue.run(), bci=38*
    testsplit is the Javafx project created in Netbeans.
    However the same application executes without any error when run in "Standard Execution" and "Run in Browser" mode. I am using Netbeans --> right click on the project --> Properties --> In Project Properties Window choose --> Run --> Standard Execution. or --? Run in Browser.
    Is it that split() is not supported by Mobile Emulator? Please do get back to me if anybody has any answer to this.
    Thanks in advance..
    masrrev

    I don't have NetBeans, so I can't answer for sure.
    I had to [read a bit|http://developers.sun.com/mobility/personal/articles/pbp_pp/] on differences between profiles, in particular [between CDC and CLDC|http://www.java-tips.org/java-me-tips/midp/what-are-cdc-and-cldc.html]. Apparently StringTokenizer belongs to CDC, which is available only to high end mobile devices. If I look at [Semsung phones' Device Specifications|http://developer.samsungmobile.com/Developer/index.jsp], most of them, for example, support only CLDC 1.1 with MIDP 2.0.
    On the other hand, [MIDP 2.0|http://java.sun.com/javame/reference/apis/jsr118/] seems to have even less classes & interfaces than you show, so it is confusing.
    Here is the dumbest method, doing all the work by hand. Not properly tested due to lack of time (check with separator at end, at start, consecutive, no separators...):
    function SplitCLDC(string: String, separator: String): String[]
      var parts: String[];
      var prevPos = 0;
      while (true)
        var pos = string.indexOf(separator, prevPos);
        if (pos < 0)
          var lastPart = string.substring(prevPos);
          insert lastPart into parts;
          break;
        var part = string.substring(prevPos, pos);
        prevPos = pos + 1;
        insert part into parts;
      return parts;
    }

  • Do / Will Lambdas work as arguments to RMI calls?

    Hello Collegues,
    the new Lambdas are a nice feature to enhance abstraction in Java.
    Especially interesting are the areas of use for Lambdas that go beyong only using them in Streams.
    One of these might be using Predicates as arguments to methods that query data from a repository,
    as opposed to using fixed set of upper an lower bounds for comparision in finder calls e.g.
    So it would be nice to give the predicate over RMI to a remote session bean method, as an example.
    The problem is, however, this fails with an IllegalStateException, probably because the calling context of the Lambda is remote,
    and thus cannot be bound to the executing context, even if no resources of the caller are used at all.
    The Wildfly 8 Server creates the following stacktrace:
    [java] (22.05.2014 12:04:47 MESZ) basisweb.global.BasisClientException: EJBCLIENT000025: No EJB receiver available
    for handling [appName:BasisWebServer, moduleName:BasisWebEJB, distinctName:] combination for invocation context org.jbos
    s.ejb.client.EJBClientInvocationContext@1d5a4a71
    [java]
    at basisweb.global.BasisClientException.createMappedException(BasisClientException.java:225)
    [java]
    at basisweb.muster.presenter.BlankoPresenter.doLambdaTest(BlankoPresenter.java:67)
    [java]
    at basisweb.muster.presenter.BlankoPresenter.reset(BlankoPresenter.java:50)
    [java]
    at basisweb.muster.presenter.BlankoPresenter.onZuruecksetzen(BlankoPresenter.java:170)
    [java]
    at basisweb.muster.gui.BlankoPanel.doActionPerformed(BlankoPanel.java:116)
    [java]
    at basisweb.global.gui.AbstractMainPanel.actionPerformed(AbstractMainPanel.java:151)
    [java]
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    [java]
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
    [java]
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    [java]
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    [java]
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    [java]
    at java.awt.Component.processMouseEvent(Component.java:6527)
    [java]
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    [java]
    at java.awt.Component.processEvent(Component.java:6292)
    [java]
    at java.awt.Container.processEvent(Container.java:2234)
    [java]
    at java.awt.Component.dispatchEventImpl(Component.java:4883)
    [java]
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    [java]
    at java.awt.Component.dispatchEvent(Component.java:4705)
    [java]
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    [java]
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
    [java]
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    [java]
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    [java]
    at java.awt.Window.dispatchEventImpl(Window.java:2739)
    [java]
    at java.awt.Component.dispatchEvent(Component.java:4705)
    [java]
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
    [java]
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    [java]
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    [java]
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    [java]
    at java.security.AccessController.doPrivileged(Native Method)
    [java]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    [java]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    [java]
    at java.awt.EventQueue$4.run(EventQueue.java:719)
    [java]
    at java.awt.EventQueue$4.run(EventQueue.java:717)
    [java]
    at java.security.AccessController.doPrivileged(Native Method)
    [java]
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    [java]
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
    [java]
    at basisweb.global.gui.BasisEventQueue.dispatchEvent(BasisEventQueue.java:85)
    [java]
    at noname.BasisWaitCursorEventQueue.dispatchEvent(BasisWaitCursorEventQueue.java:70)
    [java]
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    [java]
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    [java]
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    [java]
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    [java]
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    [java]
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
    [java] Caused by: java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName
    :BasisWebServer, moduleName:BasisWebEJB, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClien
    tInvocationContext@1d5a4a71
    [java]
    at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:749)
    [java]
    at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)
    [java]
    at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
    [java]
    at org.jboss.ejb.client.EJBClientInvocationContext.retryRequest(EJBClientInvocationContext.java:208)
    [java]
    at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:25
    6)
    [java]
    at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:26
    5)
    [java]
    at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198)
    [java]
    at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181)
    [java]
    at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)
    [java]
    at com.sun.proxy.$Proxy10.queryData(Unknown Source)
    [java]
    at basisweb.muster.presenter.BlankoPresenter.doLambdaTest(BlankoPresenter.java:59)
    [java]
    ... 42 more
    (the classes basisweb.* are from the application under test)
    Is there any chance this will be fixed any time?
    (Or does it work with other JEE7 servers? I could not check against glassfish, sorry)
    Regards from Germany,
    Thomas Nagel

    Sorry, but the first time you open them in LV 6.1 your old VIs will get converted to the new format. The good news is that for the most part basic functionality has changed very little so there should be a minimum of compatability problems. Still you will need to test them--how big that job is depends to a large extent on how modular and reusable the V4 code is.
    The biggest problem I have had in the past with this type of project is to supress the urge to "cleanup" old code by taking advantage of the advanced capabilities of later versions.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • JavaFX 8 and new Java 8 libraries

    JavaFX 2 was clearly designed with an eye on new features coming in Java 8, particularly lamba expressions. As a result, there are some JavaFX APIs which have anticipated Java 8 library enhancements. For example, the javafx.util.Callback interface is basically identical to the proposed java.util.function.Function interface (see [url http://cr.openjdk.java.net/~briangoetz/lambda/sotc3.html]here or [url http://sett.ociweb.com/sett/settFeb2013.html]here).
    Are there plans to retrofit JavaFX APIs to support the new Java 8 libraries (so I can pass a Function instead of a Callback to a setCellFactory(...) method)? It would seem to make sense to unify around the new Java APIs rather than having JavaFX versions of them. Should we expect Callback to eventually be deprecated in favor of Function?

    I guess I was envisioning scenarios where a (FX agnostic) business layer exposed Functions for manipulating data in the model. But I suppose "converting" these to Callbacks becomes completely trivial using function references... I was still thinking with my Java 7 hat on.
    It still seems a bit unwieldy to have different core APIs replicating identical functionality, though.

  • MediaPlayer crashes with Uncaught Exception: java.lang.Errror: 137

    Hi,
    I have a media player running on JavaFX 1.2 Mobile using Netbeans 6.7.1 with DefaultFxPhone emulator using JDK 1.6 Update 14.
    When starting or stopping the media player (ie. calling mediaplayer.play() or mediaplayer.pause()) using a onKeyPressed or onMousePressed event it causes this error. If i call mediaplayer.play() anywhere else in my code the media plays fine.
    the complete error is:
    Uncaught exception: java.lang.Error: 137
    - net.demo.javafx.mobile.defaultmediaplayermobile.DefaultMediaControlComponentMobile$2.lambda(), bci=190
    - net.demo.javafx.mobile.defaultmediaplayermobile.DefaultMediaControlComponentMobile$2.invoke(), bci=2
    - net.demo.javafx.mobile.defaultmediaplayermobile.DefaultMediaControlComponentMobile$2.invoke(), bci=5
    - javafx.scene.Node$NodeInputListener.mouseClicked(), bci=114
    - com.sun.fxme.input.ReleaseEvent.dispatch(), bci=131
    - com.sun.fxme.input.MouseEventDispatcher.run(), bci=71
    - com.sun.fxme.runtime.RunnableQueue$Worker.run(), bci=222
    The event listener contains code like:
    onKeyPressed: function (e:KeyEvent){
    mediaPlayer.play();
    Also the exact same code works fine when run as a desktop application in netbeans (as opposed to mobile).
    Any help would be greatly appreciated,
    Dave.

    Thanks for the suggestion, but it doesn't quite solve the problem. It looks to me in the media browser tutorial the user has an icon on the screen to re-orientate it. I'd hoped the system could detect the screen orientation changing automatically - hence the need for the bind. I guess that the fact that the medial browser tutorial doesn't do this suggests its not currently supported functionality.

  • How to call Java API classes from Javafx Main.fx?

    Hi
    Can anybody let me know how to include java.util.StringTokenizer in Main.fx file of Javafx?
    I need to split a concatenated String in Javafx. Is there any example available with anybody on this?
    When I use the split() of Javafx, I get error while assigning the value returned by split() to both String and String[] variables:
    1. var name = "test|string";
    2. var names: String[];
    3. var splitName: String = "";
    4. names[0] = name.split("|");
    5. splitName = names.split("|");
    6. var storeName: String[];
    Later I need to put the splitName into another String array to have a collection of all the concatenated string in one array.
    insert splitName into storeName;
    But I get error in line 4 and 5. The split() in javafx returns a String []. Is there anything that I missing here.
    Any reply to this post will be highly appreciated. I need this quite urgently.
    Thanks & Regards
    masrrev

    Hi Phil
    Thanks for the immediate response. I tried the code but getting the following exception, which I was getting earlier too.
    Inside on Mouse Clicked...
    Uncaught exception: java.lang.Error: 137_*
    - xing.Xing$2.lambda(), bci=43
    - xing.Xing$2.invoke(), bci=2
    - xing.Xing$2.invoke(), bci=5
    - javafx.scene.Node.mouseClicked$impl(), bci=68
    - javafx.scene.Node.mouseClicked(), bci=3
    - com.sun.fxme.runtime.FXNodeDelegate$4.run(), bci=6
    - com.sun.fxme.runtime.RunnableQueue$Manager.run(), bci=86
    - com.sun.fxme.runtime.RunnableQueue.run(), bci=38
    And the code in onMouseClicked Event is reproduced below:
    onMouseClicked: function(e : MouseEvent) : Void {
    println("Inside on Mouse Clicked...");
    def sample = "Sherlyn|masrrev|Other";
    var names = sample.split("\\|");
    println("{names.toString()}");
    // splitString();
    sceneNew = Scene {
    content: [nextScreen]
    Regards
    masrrev

  • Java 8 Book

    Hopefully its ok to post this but I just wanted everyone to know that I am currently writing a book about the next version of Java from a functional standpoint. If you are interested in learning some functional concepts using Java 8, the book should be ready this summer. I have a website www.java8book.com where you can leave your email address and I will notify when the book is available.
    Thanks
    Eric Weise

    Walter Laan wrote:
    See:
    http://en.wikipedia.org/wiki/Functional_programming
    http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-4.html
    http://cr.openjdk.java.net/~briangoetz/lambda/sotc3.html
    Yes I somehow read over the link to the book website. Doh.

  • Error while running a Java Program

    Can anyone help me,
    I am getting the following error while running a Java program, Below is the exception thrown, please help.
    java.nio.BufferOverflowException
    at java.nio.Buffer.nextPutIndex(Buffer.java:425)
    at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
    at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
    at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
    at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
    at org.jetel.graph.Edge.writeRecord(Edge.java:288)
    at com.tcs.re.component.RESummer1.run(RESummer1.java:505)
    java.nio.BufferOverflowException
    at java.nio.Buffer.nextPutIndex(Buffer.java:425)
    at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
    at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
    at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
    at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
    at org.jetel.graph.Edge.writeRecord(Edge.java:288)
    at com.tcs.re.component.RECollectCont.run(RECollectCont.java:304)

    Ok, let's see. Write the following class:
    public class Grunt {
      public static void main(String[] args) {
        System.out.println("Hello Mars");
    }Save it as "C:\Grunt.java", compile by typing:
    javac c:\Grunt.javaRun by typing:
    java -classpath "C:\" GruntDoes it say "Hello Mars"? If yes, go back to your program and compare for differences (maybe you used the "package" statement?).
    Regards

  • Erro de SYSFAIL e Queda do Ambiente JAVA (PI)

    Bom Dia
    Estou num projeto de NFe e atualmente esta acontecendo o seguinte cenário de Erros:
        Na SMQ2 , quando apresenta um aumento nas filas de Mensagens , aparece SYSFAIL em determinadas Filas , todas as outras travam , aumenta o numero de Filas.
       Com essa mensagem de SYSFAIL nas filas , o serve0 (Parte JAVA do PI) cai e após isso estou tendo que efetuar manualmente um STOP/START em todos os canais de comunnicação para que os R/3 voltem a emitir NFe.
        Isso esta ocorrendo com mais frequência após inserir uma nova empresa para emissão de NFe.
        Alguem poderia me ajudar a entender por que ocorre o SYSFAIL as mensagens travam e derruba o ambiente JAVA ?
    Sérgio.

    1º) Erro: Commit Fault: com.sap.aii.af.rfc.afcommunication.RfcAFWException:SenderA
    2º) Foi alterado o numero de Filas O numero de Filas foi alterado , mas não consigo ver esse parametros na RZ10 , tem  3 entradas : X32_DVEBMGS32_NFISAP ; DEFAULT ; START_DVEBMGS32_NFISAP nessa transação ...onde eu vejo isso
    3º) Esse parametro não tem nessa transação (/usr/sap//DVEBMGS00/j2ee/cluster/server0/log/). em qual desses diretórios abaixo eu encontro esse parametro ?
    Existe esses:
    DIR_ATRA      /usr/sap/X32/DVEBMGS32/data
    DIR_BINARY      /usr/sap/X32/DVEBMGS32/exe
    DIR_CCMS      /usr/sap/ccms
    DIR_CT_LOGGIN    /usr/sap/X32/SYS/global
    DIR_CT_RUN              /usr/sap/X32/SYS/exe/run
    DIR_DATA              /usr/sap/X32/DVEBMGS32/data
    DIR_DBMS              /usr/sap/X32/SYS/SAPDB
    DIR_EXECUTABLE /usr/sap/X32/DVEBMGS32/exe
    DIR_EXE_ROOT     /usr/sap/X32/SYS/exe
    DIR_GEN              /usr/sap/X32/SYS/gen/dbg
    DIR_GEN_ROOT    /usr/sap/X32/SYS/gen
    DIR_GLOBAL        /usr/sap/X32/SYS/global
    DIR_GRAPH_EXE  /usr/sap/X32/DVEBMGS32/exe
    DIR_GRAPH_LIB   /usr/sap/X32/DVEBMGS32/exe
    DIR_HOME             /usr/sap/X32/DVEBMGS32/work
    DIR_INSTALL        /usr/sap/X32/SYS
    DIR_INSTANCE     /usr/sap/X32/DVEBMGS32
    DIR_LIBRARY      /usr/sap/X32/DVEBMGS32/exe
    DIR_LOGGING     /usr/sap/X32/DVEBMGS32/log
    DIR_MEMORY_INSPECTOR   /usr/sap/X32/DVEBMGS32/data
    DIR_ORAHOME       /oracle/X32/102_64
    DIR_PAGING                            /usr/sap/X32/DVEBMGS32/data
    DIR_PUT                            /usr/sap/X32/put
    DIR_PERF                            /usr/sap/tmp
    DIR_PROFILE      /usr/sap/X32/SYS/profile
    DIR_PROTOKOLLS     /usr/sap/X32/DVEBMGS32/log
    DIR_REORG                          /usr/sap/X32/DVEBMGS32/data
    DIR_ROLL                          /usr/sap/X32/DVEBMGS32/data
    DIR_RSYN                            /usr/sap/X32/DVEBMGS32/exe
    DIR_SAPHOSTAGENT     /usr/sap/hostctrl
    DIR_SAPUSERS     ./
    DIR_SETUPS                           /usr/sap/X32/SYS/profile
    DIR_SORTTMP     /usr/sap/X32/DVEBMGS32/data
    DIR_SOURCE     /usr/sap/X32/SYS/src
    DIR_TEMP                           /tmp
    DIR_TRANS                           /usr/sap/trans
    DIR_TRFILES                          /usr/sap/trans
    DIR_TRSUB                          /usr/sap/trans

  • Starting deployment prerequisites: error in BI-Java installation sapinst

    Hi all,
    We are in process updating Bw 3.5 to BI 7.0 we hace sucessfully completed the Upgrade but while installing Bi java thru Sapinst in third step like java instance installtion  i was stck with the below error.
               We have downloaded the Cryptographic file and placed in jdk folder still the same problem is  coming.
    Please suggest...
    Thanks,
    Subhash.G
    Starting deployment prerequisites:
    Oct 13, 2007 2:42:18 AM  Error: Creation of DataSource for database "BWQ" failed.
    Original error message is:
    com.sap.sql.log.OpenSQLException: Error while accessing secure store: Encryption or decryption is not possible because the full version of the SAP Java Crypto Toolkit was not found (iaik_jce.jar is required, iaik_jce_export.jar is not sufficient) or the JCE Jurisdiction Policy Files don't allow the use of the "PbeWithSHAAnd3_KeyTripleDES_CBC" algorithm..
    Stack trace of original Exception or Error is:
    com.sap.sql.log.OpenSQLException: Error while accessing secure store: Encryption or decryption is not possible because the full version of the SAP Java Crypto Toolkit was not found (iaik_jce.jar is required, iaik_jce_export.jar is not sufficient) or the JCE Jurisdiction Policy Files don't allow the use of the "PbeWithSHAAnd3_KeyTripleDES_CBC" algorithm..

    Problem solved  followed the notes 1063396.

Maybe you are looking for

  • How can I control the size of a cell in the GridBagLayout?

    Hi,Swing Gurus I am developing a swing-based program using JBulider5 enterprise. It seems to me that the GridBagLayout is really a hard nut! How can I control the size of a cell in the GridBagLayout? It seems that I cann't control the size of a cell

  • Web app .war problem

    I have a war file with the following structure index.jsp WEB-INF/web.xml WEB-INF/classes (all my servlets here) WEB-INF/lib (all my application jar files) The web.xml just defines all the servlets as follows ==========================================

  • Reinstall Acrobat 9 Pro from CS4

    Hello all. I know this is to do with Adobe and not an Apple product but the help messageboards at Adobe have been useless and I've had good experiences with the help on here-so I hope someone can still help, despite the misfiling of my issue. Basical

  • How can I store a word file in database and other one download this file

    My dears: I want to upload a word file at my form then store in database and other one user want to download this file I Use developer 10g R2 Database 1og thanks more

  • Coloring of specific bars in charts built in Keynote

    Working on a presentation in Keynote 2.02. I created a bunch of column charts with gradients applied. In one instance, I have 15 columns and I want 2 of the columns within the same chart, to have a different grandient fill than the other 13. Any clue