小编Sha*_*nky的帖子

在docker容器上开发时使用IDE

在使用docker容器时开发应用程序时我没有得到一些东西.

让我说我正在开发一个java应用程序,我设置了一个带有jdk 8基本映像的java容器,我仍然需要在我的本地开发机器上安装java 8 jdk,因为我要使用的IDE将寻找运行时本地计算机上的库而不是docker容器.

这是对的还是我错过了什么?有些事情我可以完全在docker容器上做,比如设置一个数据库,但是我还需要在我的本地开发机器上做一些事情,并尝试将它与我的docker镜像匹配,例如像java或python这样的语言运行库为了使用IDE.

containers docker docker-compose docker-swarm docker-machine

39
推荐指数
2
解决办法
1万
查看次数

VirtualMachine.attach(pid) 因 java.io.IOException 失败:无法附加到当前 VM

在经历了这个讨论之后,我相信附加到同一个 VM 的选项,默认情况下在 OpenJDK11 中已被禁用。

我正在尝试将 Java 代理升级到 OpenJDK11,在VirtualMachine.attach(pid)调用测试用例期间,我看到它失败并出现以下错误。处理这种情况的正确方法是什么?

完整的堆栈跟踪:

java.io.IOException: Can not attach to current VM

at jdk.attach/sun.tools.attach.HotSpotVirtualMachine.<init>(HotSpotVirtualMachine.java:75)
at jdk.attach/sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:48)
at jdk.attach/sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:69)
at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207)
at org.kantega.notsoserial.WithAgentIT.attachAgent(WithAgentIT.java:76)
at org.kantega.notsoserial.WithAgentIT.attackShouldBePreventedWithAgent(WithAgentIT.java:47)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Run Code Online (Sandbox Code Playgroud)

java javaagents java-11

8
推荐指数
2
解决办法
6518
查看次数

从另一个函数返回`Comparator`

首先,请告诉我,我受API设计的限制,所以请不要更改API,但是可以添加私有功能.

public class Point implements Comparable<Point> {

    public Point(int x, int y)              // constructs the point (x, y)
    public void draw()                      // draws this point
    public void drawTo(Point that)          // draws the line segment from this point to that point
    public String toString()                // string representation

    public int compareTo(Point that)        // compare two points by y-coordinates, breaking ties by x-coordinates
    public double slopeTo(Point that)       // the slope between this point and that point
    public Comparator<Point> slopeOrder()   // compare two points …
Run Code Online (Sandbox Code Playgroud)

java comparator

7
推荐指数
2
解决办法
3608
查看次数